Categorygithub.com/insomnius/wallet-event-loop
modulepackage
0.0.0-20241129183745-4ff98e5d90d9
Repository: https://github.com/insomnius/wallet-event-loop.git
Documentation: pkg.go.dev

# README

Wallet With Single Threaded Event Loop - Proof of Concept

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.

Requirements

  • 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

Concept

Single Threaded Event Loop

Benchmark

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

Test Results

Test Results

Checkpoints

007c5a0ada9a3a760e3bdee86bd0c86c5e5a2bb3 -- Single threaded event loop with channel

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author