The venue's background SVG is inlined into the venue-map document rather than served as a resource of its own. VenueMapBuilder reads the file and pastes its markup into the payload, and the picker injects that markup into the page.

That has to happen today because the seat sprites are use references to a symbol defined inside the background file, and those resolve only within the same document. A linked image would draw the hall and leave every seat invisible.

It costs three things.

  • The artwork is duplicated per configuration. The background belongs to the venue, but the document is keyed by venue and configuration, because a configuration decides which areas are sold as places. Measured on a hall of 1,422 seats: the as-drawn document is 259,754 bytes and the reduced-capacity one 186,233, and the SVG inside them is byte-for-byte identical at 19,938 bytes, which is 10.7% of the smaller document. A venue with five configurations caches the same drawing five times.
  • The browser cannot cache the drawing at all. It arrives inside a JSON document that differs per configuration, so a visitor moving between two productions in the same hall downloads the artwork again each time, even though only the seat list differs (1,422 places against 947 in the measurement above).
  • A background replaced on disk is never picked up. Because the markup is a copy inside a cached response, overwriting the file (an rsync deploy, say) changes nothing a visitor sees: the cache is retired by entity and list tags, and writing bytes over a file touches no entity. Re-uploading through the venue form does work, since the file entity is a cacheable dependency of the response. Verified by overwriting the bytes on disk and re-fetching: the response was unchanged.

The approach that addresses all three is to stop inlining it: give the background its own URL and let the browser cache it as an image, which also makes an on-disk replacement visible again. That means separating the sprites from the artwork, since they cannot keep living in a file that is no longer part of the document. The sprites are tiny, so inlining them alone (or fetching them once and injecting them) is the obvious direction.

Not started. The reason to write it down now is that the original framing of this issue was wrong: it said the file was read from disk on every request, which was true when it was filed and stopped being true with #3614076: Serve the venue geometry from a cacheable endpoint instead of drupalSettings. Once the map document became cacheable the read stopped mattering, and the duplication and the staleness became the real costs. The earlier note in this issue about a 1 MB memcache item limit was also wrong and is retracted; MemcacheBackend chunks oversize items.

Issue fork yoyaku-3614077

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

mably created an issue. See original summary.

mably’s picture

Issue summary: View changes
mably’s picture

Title: The venue map background SVG is read from disk on every request » Serve the venue background SVG as its own resource instead of inlining it per configuration
Issue summary: View changes

  • mably committed 5edabeae on 1.x
    task: #3614077 Serve the venue background SVG as its own resource...
mably’s picture

Status: Active » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

mably’s picture

Merged to 1.x as 5edabea.

The artwork is fetched from the venue file's own URL and injected into the page, alongside the drawing rather than inside it. Injecting rather than linking turned out to be a requirement and not an implementation detail: a seat is a use reference to a symbol the artwork defines, and a pooled area's clickable zone is a shape inside the artwork, so an image would leave every seat invisible and every zone dead. The file therefore stays whole, and the sprite extraction this issue originally proposed is not needed.

Measured on a hall of 1,422 seats: each drawing loses 35,643 bytes (as drawn 259,754 to 224,111, reduced capacity 186,233 to 150,590). That is more than the file's own 19,939 bytes, because JSON-escaping SVG markup nearly doubles it. The artwork is now one request shared by every configuration and every production in the hall.

The URL carries the artwork's modification time, so replacing it is picked up. The file entity's changed time was tried first and is not enough: it moves only when some other field value moves, so replacing a picture with one of the same byte length would have gone unnoticed.

Two browser tests and one functional test cover it, and the kernel assertions that used to read the artwork out of the payload now read it from the file. #3614221: Document how to build a venue map, from the artwork to the places is the follow-up to document how a venue map is built.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.