Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip blank tiles for template disk cache #175

Merged
merged 6 commits into from Feb 6, 2018

Conversation

Projects
None yet
2 participants
@calh
Copy link
Contributor

commented Feb 2, 2018

Hello,

I needed a method to skip blank tiles in a disk cache template. I have my own webserver methods to return a blank pixel when a file does not exist, so the symlink feature wasn't very helpful to me anyway.

In running a small test with 1280 tiles, my test machine instance finished the run in 43.9 seconds (29.2 tiles/sec) when skipping blank tiles. 222 non-blank tiles were created. Without skip_blank in my <cache> directive, the extra 1058 blank tiles took 165.8 seconds, or 7.7 tiles/sec. That's a 280% speed increase!

I also debated on naming the XML tag detect_blank to match up with the other cache methods, but I couldn't quite figure out if the memcache, sqlite, and RETS caches actually skipped the tile, or still created null content.

I'd be happy to make any fixes or adjustments you'd like before merging this.

Thank you!

--Cal

Cal Heldenbrand added some commits Feb 2, 2018

Cal Heldenbrand
Cal Heldenbrand
Add check for fully transparent pixels
On tiles that have a solid background color, the simple blank color
check skips more than we want.  This transparent condition mirrors
the behavior in cache_rest.c
Cal Heldenbrand
Rename skip_blank => detect_blank
Since this now behaves exactly like <detect_blank/> in the REST
cache, I decided it's better to just rename skip_blank to match
the other cache methods.
@calh

This comment has been minimized.

Copy link
Contributor Author

commented Feb 5, 2018

FYI, I decided to change the behavior to match the REST cache, and rename the XML tag to detect_blank.

<!-- detect_blank
Similar to symlink_blank, except completely skip writing a file
if a blank, fully transparent tile is detected.
-->

This comment has been minimized.

Copy link
@tbonfort

tbonfort Feb 6, 2018

Member

please add a note that this setting should only be used when using the seeder. if not (i.e. tiles generated on demand), this setting will cause mapcache to query the wms source each time this tile is requested

@tbonfort

This comment has been minimized.

Copy link
Member

commented Feb 6, 2018

Hi Cal,
LGTM, please clarify in the docs that this should only be used when seeding or on a read-only cache.
Thanks,

@calh

This comment has been minimized.

Copy link
Contributor Author

commented Feb 6, 2018

@tbonfort, what do you think of that description? ( 345f794 )

Note: This setting should only be used when using the seeder.  If used
          on demand, mapcache will will query the WMS source on each subsequent 
          tile request.
@@ -6,6 +6,7 @@
<cache name="disk" type="disk">
<base>/tmp</base>
<symlink_blank/>
<detect_blank/>

This comment has been minimized.

Copy link
@tbonfort

tbonfort Feb 6, 2018

Member

please remove this line before the merge

@calh

This comment has been minimized.

Copy link
Contributor Author

commented Feb 6, 2018

ok, done @tbonfort

@tbonfort tbonfort merged commit 36301fb into mapserver:master Feb 6, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@tbonfort

This comment has been minimized.

Copy link
Member

commented Feb 6, 2018

merged, thanks @calh

@calh

This comment has been minimized.

Copy link
Contributor Author

commented Feb 6, 2018

Thank you for merging @tbonfort! When is master pushed to a new release version?

@tbonfort

This comment has been minimized.

Copy link
Member

commented Feb 6, 2018

I'm aiming for a new release in the next couple of months

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.