batch-example

command module
v0.0.0-...-465da46 Latest Latest
Warning

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

Go to latest
Published: May 28, 2022 License: MIT Imports: 6 Imported by: 0

README

Batch example

Web application example using github.com/elgopher/batch package.

How to run?

  • Install docker, docker-compose, curl

  • Start web application with Postgres database

$ docker-compose up

  • Buy a train ticket

$ curl -v "http://localhost:8080/book?train=batchy&person=elgopher&seat=3"

Load testing

You can run script.js in K6 by executing:

$ docker run --network batch-example_default --rm -i grafana/k6 run - <script.js

Why optimistic locking was used?

Because optimistic locking does not require having long-running transactions, which in turn consume database connections. This is especially important here, because batches takes significant amount of time (more than 100ms). With the use of optimistic locking this example application could handle 100k+ requests per second using just 100 database connections.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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