Handling Socket Lagging during Write Operations

A common problem when working with non-blocking sockets it that a client may lag when the send rate is too high, in other words, the client will push out messages faster then the network card can send and/or the other side’s network card can receive them. That will cause the underlying write socket buffer at the OS/Kernel level to fill up. In this article we explain how CoralReactor handles this complex scenario in a simple way so that you don’t have to worry about it. Continue reading

Inter-Process Communication with CoralQueue

CoralQueue is great for inter-thread communication, when both threads are running in the same JVM. However it also supports inter-process communication (IPC) through a shared memory mapped file so that two threads running on the same machine but on different JVMs can exchange messages. This is much faster than the other option which would be network access through loopback. In this article we will examine how this can be easily done and present the benchmark numbers for IPC. Continue reading

Inter-thread communication within CoralReactor

CoralReactor was built on purpose, from the ground up, to be single-threaded. That means that no other thread besides the reactor thread should be executing any code or accessing any data belonging to servers and clients. This not only provides super-fast performance but also allows for much simpler code that does not have to worry about thread synchronization, lock contention, race-conditions, deadlocks, thread starvation and many other pitfalls of multithreaded programming. However there are common scenarios where other threads must interact with the reactor thread. In this article we analyze in detail how this is done, without breaking the single-threaded design principle and without creating any garbage. Continue reading