Score:0

Can varnish serve from a port and clone the request to another port?

au flag

I have a problem to solve in my current deployment. The current one looks like this.

Varnish on port 80 in front of Nginx on port 8000 backed by uWSGI

The problem here is, The client want to implement some in house analytics which are required for business logic, implemented in Python served with uWSGI. Most of the varnish hits are gone uncounted (Hits are Anonymous). Two solutions came up are.

  1. Hit a non cached server from clients (Here clients are Android devices. Two Requests per request are very costly in terms of battery usage
  2. Proxy or clone the requests at varnish to another server where the analytics server can ingest the request. May be with UDP.

Is the 2nd solution relevant? Is it possible to do this? If yes, how can someone do this?

Score:2
in flag

vmod_curl

It is possible to send an extra request to an external endpoint. I would advise you to do this through vmod_curl, a cURL module for Varnish.

See https://github.com/varnish/libvmod-curl for more information.

However, sending an extra call for every incoming request can be quite taxing on your analytics system. The reason why you're probably using Varnish is to avoid that your origin systems get overloaded.

Varnish's logging & statistics tools

And when it comes to analytics, the tools that Varnish provide are second to none.

Here are some references regarding Varnish's logging & statistics tools:

The logging (varnishlog, varnishtop & varnishncsa) tools are based on VSL, so here are some VSL references:

And finally, here's a reference to the counters that are used by varnishstat: http://varnish-cache.org/docs/6.0/reference/varnish-counters.html

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.