Skip to content

Commit

Permalink
[3scale_batcher] Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
tkan145 committed Mar 28, 2024
1 parent 0e6e176 commit f1e0a96
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions gateway/src/apicast/policy/3scale_batcher/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,29 @@ The effectiveness of this policy will depend on the cache hit ratio. For use
cases where the variety of services, apps, metrics, etc. is relatively low,
caching and batching will be very effective and will increase the throughput of
the system significantly.

### How many key/value pairs can be contained in 20m of shared memory.

On my Linux x86_64 system `1m` can hold `4033 key/value pairs` with 64-byte keys and
15-byte values. Changing the size of the shared storage to 10m gives `40673 key/value pairs`.
It's a linear growth as expected.

The following table shows the number of key/value pairs for different storage size:

| Shared storage size | Key length | Value length | Key/value pairs |
| ---- | ---- | ---- | ---- |
| 10m | 64 | 15 | 40672 |
| | 128 | 15 | 40672 |
| | 256 | 15 | 20336 |
| | 512 | 15 | 10168 |
| 20m | 64 | 15 | 81408 |
| | 128 | 15 | 81408 |
| | 256 | 15 | 40704 |
| | 512 | 15 | 20352 |
| 40m | 64 | 15 | 162848 |
| | 128 | 15 | 162848 |
| | 256 | 15 | 81424 |
| | 512 | 15 | 40712 |

In practice, the actual number will depend on the size of the key/value pair, the
underlying OS architecture, memory segment sizes, etc... More details [here](https://blog.openresty.com/en/nginx-shm-frag/)

0 comments on commit f1e0a96

Please sign in to comment.