HTTP_ACCUMULATOR

command module
v0.0.0-...-db185d6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 25, 2020 License: Unlicense Imports: 14 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

http_accumulator

Acts as a proxy that accumulates many small http requests into a smaller number of batch requests

Example

Supose you have a microservice server that serves a user's age given their ids:

normal client server

You can deploy accumulator in between so that the server recieves a smaller of number of batch requests

client accumulator server

This can improve performance in some cases.

In those cases the Accumulator is a helpful way of having the batch control at the server side instead of leaving it to the clients.

Testing it

docker-compose up will raise the test stack which consists of:

  • accumulator at port 9992
  • doubler server at port 9991 (a simple server that doubles numbers for you)

Send requests to our demo 'doubler' server at curl localhost:9991 --data 12 --data 10 to see it in action.

Now, use the accumulator to consolidate singular requests into larger batches

for i in `seq 10`; do curl localhost:9992 --data $i > /tmp/testing_$i & done
cat /tmp/testing_*

The accumulator will wait and hold connections until there are N accumulated requests or T time has passed since the first request and finally send everything to the underlying server. It will then de-multiplex responses and send the correct one to each client

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL