Use atomic types to speedup variable difficulty alogirthm #3
No reviewers
Labels
No labels
bug
duplicate
enhancement
help wanted
invalid
question
renovate-bot
renovate-security
security
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: mCaptcha/dcache#3
Loading…
Reference in a new issue
No description provided.
Delete branch "optimize-libmcaptha"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The actor model currently in use in libmCaptcha is causing a bottleneck that was previously not visible. Protobuf implementation from #1 was yielding very low throughput.
Generating [a flamegraph of that version showed that the
AddVisitor
message handler was taking up ~59% of the CPU time while the node was hit with the locust benchmark. Keeping track of visitor count is a critical path in the variable difficulty algorithm, but this particular test also involved message serializing/deserializing, request routing and networking, so 59% CPU time seemed odd.Using CPU concurrency primitives in the place of actors, optimizing memory allocation, and concurrent memory access significantly reduce the footprint of the adding visitor path. The new implementation takes only 0.4% of CPU time on the same benchmark run.
ef59cd0d01
toc11f89094a