Through the additional of a secondary signalling channel,
whenever there are sufficient messages in the queue to fill a "batch",
the processing goroutine will be immediately woken. Because the
buffered channel has double that capacity, requests should never be
delayed unless the server is actually overloaded.
This preserves the improvements of the previous commit, meaning that,
even when a batch size of 10 and a batch delay of 1s is used:
- there is no background load; if no messages are received, the server
is dormant;
- if no message was received in the last second, a new message will be
immediately processed;
- if a small number of messages are received after the first, the
additional messages will be collected and processed in a single
transaction after the configured delay;
- if enough new messages arrive to fill a batch (ie 10 in this example),
they will be immediately processed, freeing up capacity for more
messages;
- if up to double the configured number of messages arrive in a burst,
there will be sufficient capacity to cache them immediately,
regardless of how slowly the mysql server commits each transaction
Instead of using a deque, store incoming messages in a native
buffered channel, if buffering is enabled.
In addition, modify the batching algorithm so the enforced delay
between consecutive `addMessages` invocations is applied after
all pending messages are processed. This acts as a "cooldown", rather
than a "warmup". This avoids the need for more complex timing logic to
dispatch batches, removes latency in adding messages when received
infrequently, and natively blocking the goroutine until messages are
received.
Because the message processing loop always performs a blocking read
first, it is appropriate for low-throughput environments just as much as
high-throughput ones.
The default value of batchSize has been changed to 10, with a zero
cooldown. This means that when messages are arriving faster than they
can be inserted into sqlite, they will automatically become batched in
groups of up to 10.
With this change, any developer can simply open a development environment in Gitpod. The environment has docs, web, and binary being built on every code change.
Also included the vscode extensions for Go and Docker.
Signed-off-by: Yarden Shoham <hrsi88@gmail.com>
Added a new button. When clicked it'll generate a random alphanumeric string and append to the current topic (or replace if empty).
Signed-off-by: Yarden Shoham <hrsi88@gmail.com>