This proof of concept is intended to show you how single threaded event loop could solve concurrency problem that happen in a online wallet usecases.
- User can be created and have a wallet.
- User can top up their wallet
- User can transfer their money from their wallet to another wallet
- User can see their top 5 incoming and outgoing wallet mutations
DB package benchmark
Running tool: /usr/local/go/bin/go test -benchmem -run=^$ -bench ^BenchmarkTransaction$ github.com/insomnius/wallet-event-loop/db
goos: linux
goarch: amd64
pkg: github.com/insomnius/wallet-event-loop/db
cpu: 12th Gen Intel(R) Core(TM) i5-12400F
BenchmarkTransaction-12 48580 22459 ns/op 40989 B/op 182 allocs/op
PASS
ok github.com/insomnius/wallet-event-loop/db 1.345s
Transfer process benchmark
Running tool: /usr/local/go/bin/go test -benchmem -run=^$ -bench ^BenchmarkTransfer$ github.com/insomnius/wallet-event-loop/agregation
goos: linux
goarch: amd64
pkg: github.com/insomnius/wallet-event-loop/agregation
cpu: 12th Gen Intel(R) Core(TM) i5-12400F
BenchmarkTransfer-12 296427 3563 ns/op 10936 B/op 31 allocs/op
PASS
ok github.com/insomnius/wallet-event-loop/agregation 1.103s
007c5a0ada9a3a760e3bdee86bd0c86c5e5a2bb3 -- Single threaded event loop with channel