A simple, distributed, in-memory cache service with TLS auth.
NOTE: doing this for practicing building production grade systems, THIS IS NOWHERE NEAR READY 😅
The following benchmark tests (client/benchmark_test.go
) were run against local CFE server, using client/client.go
with all Ganache components running on the same host.
$ cd client && go test -bench=CFE -benchtime=100000x -benchmem
goos: linux
goarch: amd64
pkg: github.com/althk/ganache/client
cpu: Intel(R) Core(TM) i7-1065G7 CPU @ 1.30GHz
BenchmarkCFEGetString-8 100000 82826 ns/op 5289 B/op 99 allocs/op
BenchmarkCFEGetInt64-8 100000 83450 ns/op 5238 B/op 98 allocs/op
PASS
ok github.com/althk/ganache/client 16.660s
To try this out locally real quick:
- Install etcd
- Clone the repo.
git clone https://github.com/althk/ganache
- Decide how many shards to use for distributed-ness, default is
1
, i.e, no sharding. - If you prefer to test it out using the provided Docker images (preferred), install
docker
anddocker-compose
for your platform.
After taking care of the pre-reqs mentioned above:
cd ganache
docker-compose up --build
- This will start all the components within a bridged docker network. The ports are mapped on arbitrary ports on the host. To test all the wiring:
docker-compose run client-benchmark
- This will start all the components within a bridged docker network. The ports are mapped on arbitrary ports on the host. To test all the wiring:
cd ganache
- Open new terminal, start etcd
make run-etcd
- Open new terminal, start Cache Shard Manager (CSM)
make run-csm1
- Open new terminal, start one or more Cache Servers (at least one for each shard)
make run-cacheserver1
- Open new terminal, start Cache Frontend (CFE)
make run-cfe1
- Use the
client
package to make use of the service. Seeclient/benchmark_test.go
for an example of how to set/get items from cache. - To test all the wiring
make run-client-benchmark