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 18:58:40 +03:00
parent 51b236a69f
commit 1e38dbdf35
127 changed files with 12148 additions and 2139 deletions
+11
View File
@@ -0,0 +1,11 @@
# API cache performance experiment
# generated: 2026-10-06T14:45:30Z
running trial 1, cache=False, requests=1000
{"requests": 1000, "workers": 8, "duration_seconds": 0.37162104109302163, "rps": 2690.9132945184524, "p50_ms": 2.7035834500566125, "p95_ms": 4.306332906708121, "p99_ms": 10.301249916665256, "trial": 1, "cache_enabled": false}
running trial 1, cache=True, requests=1000
{"requests": 1000, "workers": 8, "duration_seconds": 0.3306667919969186, "rps": 3024.1924021488035, "p50_ms": 2.4096459965221584, "p95_ms": 3.9726250106468797, "p99_ms": 5.2115831058472395, "trial": 1, "cache_enabled": true}
running trial 2, cache=False, requests=1000
{"requests": 1000, "workers": 8, "duration_seconds": 0.36050741700455546, "rps": 2773.868033864512, "p50_ms": 2.6389374979771674, "p95_ms": 4.281750065274537, "p99_ms": 6.4238749910146, "trial": 2, "cache_enabled": false}
running trial 2, cache=True, requests=1000
{"requests": 1000, "workers": 8, "duration_seconds": 0.3070590420393273, "rps": 3256.7026633005735, "p50_ms": 2.3015625192783773, "p95_ms": 3.6923339357599616, "p99_ms": 4.840250010602176, "trial": 2, "cache_enabled": true}
{"results": [{"requests": 1000, "workers": 8, "duration_seconds": 0.37162104109302163, "rps": 2690.9132945184524, "p50_ms": 2.7035834500566125, "p95_ms": 4.306332906708121, "p99_ms": 10.301249916665256, "trial": 1, "cache_enabled": false}, {"requests": 1000, "workers": 8, "duration_seconds": 0.3306667919969186, "rps": 3024.1924021488035, "p50_ms": 2.4096459965221584, "p95_ms": 3.9726250106468797, "p99_ms": 5.2115831058472395, "trial": 1, "cache_enabled": true}, {"requests": 1000, "workers": 8, "duration_seconds": 0.36050741700455546, "rps": 2773.868033864512, "p50_ms": 2.6389374979771674, "p95_ms": 4.281750065274537, "p99_ms": 6.4238749910146, "trial": 2, "cache_enabled": false}, {"requests": 1000, "workers": 8, "duration_seconds": 0.3070590420393273, "rps": 3256.7026633005735, "p50_ms": 2.3015625192783773, "p95_ms": 3.6923339357599616, "p99_ms": 4.840250010602176, "trial": 2, "cache_enabled": true}], "users": 4, "chats": 60, "sessions_cached_in_both_modes": true}
+39
View File
@@ -0,0 +1,39 @@
# Cache consistency evidence (track 1)
# generated: 2026-10-06T14:43:46Z
# redis: localhost:6379 db=1
=== RUN TestChatRepositorySuite
=== RUN TestChatRepositorySuite/TestConcurrentColdReadsAreDeduplicated
chat_repository_test.go:167: distributed lock: 100 concurrent cold reads -> 1 source loads
=== RUN TestChatRepositorySuite/TestConcurrentColdReadsWithoutProtectionStampede
chat_repository_test.go:265: stampede demonstration: 100 concurrent reads -> 100 source loads
=== RUN TestChatRepositorySuite/TestCreateInvalidatesMemberCaches
=== RUN TestChatRepositorySuite/TestDeeperPagesBypassCache
=== RUN TestChatRepositorySuite/TestFirstPageIsCached
=== RUN TestChatRepositorySuite/TestLimitIsPartOfCacheKey
=== RUN TestChatRepositorySuite/TestMultipleInstancesShareDistributedLock
chat_repository_test.go:215: multi-instance distributed lock: 3 instances x 30 reads -> 1 source loads
--- PASS: TestChatRepositorySuite (0.14s)
--- PASS: TestChatRepositorySuite/TestConcurrentColdReadsAreDeduplicated (0.04s)
--- 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)
--- PASS: TestChatRepositorySuite/TestMultipleInstancesShareDistributedLock (0.05s)
=== 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.418s
+22
View File
@@ -0,0 +1,22 @@
# Cache latency experiment
# generated: 2026-10-06T15:53:09Z
go version go1.27.1 darwin/arm64
Darwin arm64
2026/10/06 18:53:10 OK 00001_init.sql (10.27ms)
2026/10/06 18:53:10 goose: successfully migrated database to version: 1
=== RUN TestCacheLatencyExperiment
cache_latency_experiment_test.go:83: baseline: requests=1000 source_loads=1000 p50=317.209µs p95=343.542µs p99=377.625µs
cache_latency_experiment_test.go:84: redis cache: requests=1000 source_loads=1 p50=411.791µs p95=527.709µs p99=565.625µs
--- PASS: TestCacheLatencyExperiment (0.97s)
=== RUN TestCacheLatencyExperiment
cache_latency_experiment_test.go:83: baseline: requests=1000 source_loads=1000 p50=271.125µs p95=330.584µs p99=389.209µs
cache_latency_experiment_test.go:84: redis cache: requests=1000 source_loads=1 p50=388µs p95=453.959µs p99=512.625µs
--- PASS: TestCacheLatencyExperiment (0.86s)
=== RUN TestCacheLatencyExperiment
cache_latency_experiment_test.go:83: baseline: requests=1000 source_loads=1000 p50=268.541µs p95=318.417µs p99=367.083µs
cache_latency_experiment_test.go:84: redis cache: requests=1000 source_loads=1 p50=408.833µs p95=473.125µs p99=541.042µs
--- PASS: TestCacheLatencyExperiment (0.88s)
PASS
ok mtusi-messenger/internal/storage/postgres 3.097s
? 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-06T15:53:01Z
go version go1.27.1 darwin/arm64
Darwin arm64
2026/10/06 18:53:02 OK 00001_init.sql (10.14ms)
2026/10/06 18:53:02 goose: successfully migrated database to version: 1
=== RUN TestCachePerformanceExperiment
cache_performance_experiment_test.go:111: baseline (no cache): requests=10000 concurrency=50 sql=10000 duration=1.247s rps=8017 p50=6.073542ms p95=7.541167ms p99=9.156083ms
cache_performance_experiment_test.go:112: redis cache (cold): requests=10000 concurrency=50 sql=1 duration=434ms rps=23022 p50=2.045375ms p95=3.3065ms p99=4.115042ms
cache_performance_experiment_test.go:113: redis cache (hot): requests=10000 concurrency=50 sql=0 duration=399ms rps=25055 p50=1.948541ms p95=2.716833ms p99=3.293792ms
--- PASS: TestCachePerformanceExperiment (2.38s)
=== RUN TestCachePerformanceExperiment
cache_performance_experiment_test.go:111: baseline (no cache): requests=10000 concurrency=50 sql=10000 duration=1.275s rps=7844 p50=6.254833ms p95=7.301042ms p99=9.071333ms
cache_performance_experiment_test.go:112: redis cache (cold): requests=10000 concurrency=50 sql=1 duration=375ms rps=26668 p50=1.822291ms p95=2.375625ms p99=3.260166ms
cache_performance_experiment_test.go:113: redis cache (hot): requests=10000 concurrency=50 sql=0 duration=372ms rps=26890 p50=1.826083ms p95=2.368833ms p99=3.16875ms
--- PASS: TestCachePerformanceExperiment (2.26s)
=== RUN TestCachePerformanceExperiment
cache_performance_experiment_test.go:111: baseline (no cache): requests=10000 concurrency=50 sql=10000 duration=1.236s rps=8093 p50=6.084917ms p95=6.878625ms p99=7.891209ms
cache_performance_experiment_test.go:112: redis cache (cold): requests=10000 concurrency=50 sql=1 duration=378ms rps=26432 p50=1.832208ms p95=2.499917ms p99=3.223166ms
cache_performance_experiment_test.go:113: redis cache (hot): requests=10000 concurrency=50 sql=0 duration=404ms rps=24747 p50=1.95875ms p95=2.878375ms p99=3.453333ms
--- PASS: TestCachePerformanceExperiment (2.26s)
PASS
ok mtusi-messenger/internal/storage/postgres 7.277s
? mtusi-messenger/internal/storage/postgres/internal/sqlcgen [no test files]
? mtusi-messenger/internal/storage/postgres/migrations [no test files]