lab2
Application / Lint (pull_request) Canceled after 0s
Application / Unit tests (pull_request) Canceled after 0s
Application / Docker build (pull_request) Canceled after 0s
Skeleton contracts / contracts (pull_request) Canceled after 0s

This commit is contained in:
Vladislav Kunetskiy
2026-10-06 00:19:15 +03:00
parent 51b236a69f
commit 5ea57db639
119 changed files with 9935 additions and 2138 deletions
+11
View File
@@ -0,0 +1,11 @@
# API cache performance experiment
# generated: 2026-10-05T20:32:23Z
running trial 1, cache=False, requests=1000
{"requests": 1000, "workers": 8, "duration_seconds": 0.37194291700143367, "rps": 2688.584603416834, "p50_ms": 2.7120834565721452, "p95_ms": 4.2240830371156335, "p99_ms": 5.933874985203147, "trial": 1, "cache_enabled": false}
running trial 1, cache=True, requests=1000
{"requests": 1000, "workers": 8, "duration_seconds": 0.30397041607648134, "rps": 3289.7938322668615, "p50_ms": 2.237749984487891, "p95_ms": 3.605750040151179, "p99_ms": 5.097458022646606, "trial": 1, "cache_enabled": true}
running trial 2, cache=False, requests=1000
{"requests": 1000, "workers": 8, "duration_seconds": 0.4000672500114888, "rps": 2499.5797580813796, "p50_ms": 2.929750015027821, "p95_ms": 4.9592910800129175, "p99_ms": 7.416000007651746, "trial": 2, "cache_enabled": false}
running trial 2, cache=True, requests=1000
{"requests": 1000, "workers": 8, "duration_seconds": 0.3116560000926256, "rps": 3208.665964084745, "p50_ms": 2.319625054951757, "p95_ms": 3.7357090041041374, "p99_ms": 4.752291017211974, "trial": 2, "cache_enabled": true}
{"results": [{"requests": 1000, "workers": 8, "duration_seconds": 0.37194291700143367, "rps": 2688.584603416834, "p50_ms": 2.7120834565721452, "p95_ms": 4.2240830371156335, "p99_ms": 5.933874985203147, "trial": 1, "cache_enabled": false}, {"requests": 1000, "workers": 8, "duration_seconds": 0.30397041607648134, "rps": 3289.7938322668615, "p50_ms": 2.237749984487891, "p95_ms": 3.605750040151179, "p99_ms": 5.097458022646606, "trial": 1, "cache_enabled": true}, {"requests": 1000, "workers": 8, "duration_seconds": 0.4000672500114888, "rps": 2499.5797580813796, "p50_ms": 2.929750015027821, "p95_ms": 4.9592910800129175, "p99_ms": 7.416000007651746, "trial": 2, "cache_enabled": false}, {"requests": 1000, "workers": 8, "duration_seconds": 0.3116560000926256, "rps": 3208.665964084745, "p50_ms": 2.319625054951757, "p95_ms": 3.7357090041041374, "p99_ms": 4.752291017211974, "trial": 2, "cache_enabled": true}], "users": 4, "chats": 60, "sessions_cached_in_both_modes": true}
+36
View File
@@ -0,0 +1,36 @@
# Cache consistency evidence (track 1)
# generated: 2026-10-04T13:47:04Z
# redis: localhost:6379 db=1
=== RUN TestChatRepositorySuite
=== RUN TestChatRepositorySuite/TestConcurrentColdReadsAreDeduplicated
chat_repository_test.go:158: singleflight: 100 concurrent cold reads -> 1 source loads
=== RUN TestChatRepositorySuite/TestConcurrentColdReadsWithoutProtectionStampede
chat_repository_test.go:207: stampede demonstration: 100 concurrent reads -> 100 source loads
=== RUN TestChatRepositorySuite/TestCreateInvalidatesMemberCaches
=== RUN TestChatRepositorySuite/TestDeeperPagesBypassCache
=== RUN TestChatRepositorySuite/TestFirstPageIsCached
=== RUN TestChatRepositorySuite/TestLimitIsPartOfCacheKey
--- PASS: TestChatRepositorySuite (0.11s)
--- PASS: TestChatRepositorySuite/TestConcurrentColdReadsAreDeduplicated (0.06s)
--- PASS: TestChatRepositorySuite/TestConcurrentColdReadsWithoutProtectionStampede (0.02s)
--- PASS: TestChatRepositorySuite/TestCreateInvalidatesMemberCaches (0.01s)
--- PASS: TestChatRepositorySuite/TestDeeperPagesBypassCache (0.00s)
--- PASS: TestChatRepositorySuite/TestFirstPageIsCached (0.00s)
--- PASS: TestChatRepositorySuite/TestLimitIsPartOfCacheKey (0.01s)
=== RUN TestSessionRepositorySuite
=== RUN TestSessionRepositorySuite/TestCacheTTLCapAndSessionExpiry
=== RUN TestSessionRepositorySuite/TestEvictedCacheEntryReloadsFromSource
=== RUN TestSessionRepositorySuite/TestExpiredSessionIsRejected
=== RUN TestSessionRepositorySuite/TestResolveFallsBackToSourceOnMiss
=== RUN TestSessionRepositorySuite/TestResolvePopulatesCacheAndServesFromIt
=== RUN TestSessionRepositorySuite/TestRevokeEvictsCacheAndSource
--- PASS: TestSessionRepositorySuite (0.01s)
--- PASS: TestSessionRepositorySuite/TestCacheTTLCapAndSessionExpiry (0.00s)
--- PASS: TestSessionRepositorySuite/TestEvictedCacheEntryReloadsFromSource (0.00s)
--- PASS: TestSessionRepositorySuite/TestExpiredSessionIsRejected (0.00s)
--- PASS: TestSessionRepositorySuite/TestResolveFallsBackToSourceOnMiss (0.00s)
--- PASS: TestSessionRepositorySuite/TestResolvePopulatesCacheAndServesFromIt (0.00s)
--- PASS: TestSessionRepositorySuite/TestRevokeEvictsCacheAndSource (0.00s)
PASS
ok mtusi-messenger/internal/storage/redis 0.565s
+22
View File
@@ -0,0 +1,22 @@
# Cache latency experiment
# generated: 2026-10-05T19:27:40Z
go version go1.27.1 darwin/arm64
Darwin arm64
2026/10/05 22:27:42 OK 00001_init.sql (10.85ms)
2026/10/05 22:27:42 goose: successfully migrated database to version: 1
=== RUN TestCacheLatencyExperiment
cache_latency_experiment_test.go:67: baseline: requests=1000 source_loads=1000 p50=518.084µs p95=915.292µs p99=1.312875ms
cache_latency_experiment_test.go:68: redis cache: requests=1000 source_loads=1 p50=593.625µs p95=1.013958ms p99=1.388084ms
--- PASS: TestCacheLatencyExperiment (1.35s)
=== RUN TestCacheLatencyExperiment
cache_latency_experiment_test.go:67: baseline: requests=1000 source_loads=1000 p50=524.875µs p95=847.917µs p99=1.037875ms
cache_latency_experiment_test.go:68: redis cache: requests=1000 source_loads=1 p50=882.042µs p95=1.2005ms p99=1.415583ms
--- PASS: TestCacheLatencyExperiment (1.59s)
=== RUN TestCacheLatencyExperiment
cache_latency_experiment_test.go:67: baseline: requests=1000 source_loads=1000 p50=509.292µs p95=774.875µs p99=987.583µs
cache_latency_experiment_test.go:68: redis cache: requests=1000 source_loads=1 p50=475.375µs p95=927.708µs p99=1.195708ms
--- PASS: TestCacheLatencyExperiment (1.26s)
PASS
ok mtusi-messenger/internal/storage/postgres 5.016s
? mtusi-messenger/internal/storage/postgres/internal/sqlcgen [no test files]
? mtusi-messenger/internal/storage/postgres/migrations [no test files]
+25
View File
@@ -0,0 +1,25 @@
# Cache performance experiment
# generated: 2026-10-05T19:28:14Z
go version go1.27.1 darwin/arm64
Darwin arm64
2026/10/05 22:28:15 OK 00001_init.sql (13.83ms)
2026/10/05 22:28:15 goose: successfully migrated database to version: 1
=== RUN TestCachePerformanceExperiment
cache_performance_experiment_test.go:94: baseline (no cache): requests=10000 concurrency=50 sql=1 duration=1.327s rps=7534 p50=6.455042ms p95=7.747375ms p99=10.882916ms
cache_performance_experiment_test.go:95: redis cache (cold): requests=10000 concurrency=50 sql=0 duration=893ms rps=11204 p50=4.412375ms p95=5.025167ms p99=6.189958ms
cache_performance_experiment_test.go:96: redis cache (hot): requests=10000 concurrency=50 sql=0 duration=895ms rps=11177 p50=4.396541ms p95=5.287709ms p99=6.229542ms
--- PASS: TestCachePerformanceExperiment (3.45s)
=== RUN TestCachePerformanceExperiment
cache_performance_experiment_test.go:94: baseline (no cache): requests=10000 concurrency=50 sql=1 duration=1.279s rps=7817 p50=6.285041ms p95=7.161833ms p99=9.118583ms
cache_performance_experiment_test.go:95: redis cache (cold): requests=10000 concurrency=50 sql=0 duration=886ms rps=11286 p50=4.3635ms p95=5.0135ms p99=5.986041ms
cache_performance_experiment_test.go:96: redis cache (hot): requests=10000 concurrency=50 sql=0 duration=884ms rps=11317 p50=4.379667ms p95=5.01725ms p99=5.431542ms
--- PASS: TestCachePerformanceExperiment (3.39s)
=== RUN TestCachePerformanceExperiment
cache_performance_experiment_test.go:94: baseline (no cache): requests=10000 concurrency=50 sql=1 duration=1.299s rps=7697 p50=6.23975ms p95=8.681917ms p99=10.371709ms
cache_performance_experiment_test.go:95: redis cache (cold): requests=10000 concurrency=50 sql=0 duration=897ms rps=11147 p50=4.438375ms p95=5.078459ms p99=5.789542ms
cache_performance_experiment_test.go:96: redis cache (hot): requests=10000 concurrency=50 sql=0 duration=902ms rps=11091 p50=4.395708ms p95=5.31425ms p99=7.578416ms
--- PASS: TestCachePerformanceExperiment (3.35s)
PASS
ok mtusi-messenger/internal/storage/postgres 10.620s
? mtusi-messenger/internal/storage/postgres/internal/sqlcgen [no test files]
? mtusi-messenger/internal/storage/postgres/migrations [no test files]