Increase page views with varnish and ESI

If I use Varnish to cache all of my documents, what mechanism would you recommend, I also increase the number of page views.

For example, let me assume that I have a list of auctions, such as ebay, and I would like to cache the entire page, since I know that it will never change.

How would you increase the page views of this list.

Suppose my application is running from the Zend Framework. Would it be right to make ESI (Edge Side Include) on a node.js server that increases the number of page views in Redis?

I'm looking for something that will be 100% supported and will be the exact page view request number. (I also don’t worry about repeated requests, I will process this in my application logic to prevent the inclusion of a single IP address in the number of page views).

+6
source share
1 answer

I would separate your statistics logic from your application. Use a small piece of javascript that requests a resource with a unique timestamp (for example, an image like /statistics?pageId=3&ts=234234249 ). You can cache your full page (no need to worry about ESI) and have statistics processed by a fast (multiplexing) server, for example node.js, netty, tornado.

If you need a β€œCount” page on your page, ask for a small piece of javascript / json data instead of an image and update the DOM in javascript.

Thus, you can register the best statistics (for example, page sizes), you minimize traffic and save statistics as a separate problem.

+7
source

Source: https://habr.com/ru/post/902630/


All Articles