I hope you can help
I have a image server that generates images on the fly. I'm using varnish to cache generated images.
I need to record how many requests (per image) varnish receives as well as if it was a hit or miss (pass gets marked as miss). Currently, I'm writing access logs with hit/miss to file, I then using crontab process this access-log file and write the data to my db...
What I would like to do instead is:
Have Varnish make a request to my backend notifying it of a cache hit (and if possible the response size (bytes)). My backend could then save this data...
Is this at all possible and if so how?
In-case anybody is interested:
- 2 varnish instances each with 1 (java+tomcat) backend.
- Service manipulates and generates each image specific to the requirements made in the request...
Below are per day:
- Over 35 million page views where each page has at least 3 images in it.
- Varnish gets around 3+ million requests for images (images are also cached by the browser).
- Varnish has a 87% hit rate
- Response times for a hit are a few micro seconds
- Response times for a miss are 50ms to 1000ms depending on the size of the image (both source and output)