Repository navigation
Read tiles into an unzeroed buffer from the request pool, save ~0.6ms per tile - #517
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #517 +/- ##
==========================================
+ Coverage 81.54% 82.05% +0.51%
==========================================
Files 24 24
Lines 5645 5321 -324
==========================================
- Hits 4603 4366 -237
+ Misses 1042 955 -87 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
This one is actually not ready, as we can see from mac osx CI.... |
|
Okay so actually the mac failure is due to a build time vs runtime discrepancy in apache portable runtime. mod_tile was built against APR 1.5.2, but the tests used homebrew's httpd 2.4.68 which linked against APR 1.7.6. This creates a strange situation where mod_tile's calls to apr_* are assuming 1.5.2 but the request pool objects were made by APR 1.7.6 from httpd. The allocator struct changed between those versions and a bunch of fields have different offsets which causes an immediate segfault on the first tile. Interestingly, smaller allocations are succeeding purely by chance because they only touch fields that didn't move. |
|
I was going to try to split this out into two or three stacked PRs but that would be confusing so I'll just update it here. We can fix the issue better by having APR's symbols bind to httpd's version at load time like how httpd's own symbols do already. |
Ever since #491, #492,
tile_handler_serve's 1 megabyte buffer has been zero filled and pulled from a fresh pool with its own allocator, destroyed after every request. This means every tile request is going to fault in and zero 256 fresh pages of memory. This contends significantly under multithreaded load on the mmap lock. I have a test setup that mirrors tile.osm.org as well as I can (full planet, replaying tile requests, event MPM, 64 threads per child, HTTPS enabled, 28% of requests are If-None-Match conditional). Apache's CPU time per tile is decreased from 755 micros to 134 micro with this PR, which allocates the buffer from the request pool without zeroing it out. This matches the behavior of v0.8.1 which used plain malloc. The 134 micro time now matches v0.8.1 again.