Welcome! Log In Create A New Profile

Advanced

Varnish using Nginx as reverse proxy

Posted by eaonflux 
Varnish using Nginx as reverse proxy
July 04, 2011 07:57AM
HI,

well i hope i made the title correct but anyway, i am using Nginx for along time now.
No advance configs, just as a plain webserver.
and running it with Wordpress, but WP takes abit more resources then some other CMS'ses and can be slowing things down.

Last week i learned about Varnish, but i am abit puzzled about it.

I use Varnish with Nginx with multiple backend servers because i have more websites then 1.
Don't get me wrong it's working fine but after a week of reading Fora's and Wiki's i got puzzled if i am doing it right?

because if i read this Tutorial:
http://www.online-tutorials.net/internet-netzwerk/nginx/tutorials-t-29-300.html
and the follow up
http://www.online-tutorials.net/internet-netzwerk/varnish-caching-proxy/tutorials-t-29-299.html

They are suggesting that they use it like this:
Nginx -> Varnish -> Nginx (Why?)

i am using it like this: Varnish -> Nginx
and if i read the Varnish Wiki, they suggest that you put Varnish upfront, like i did.

Why would i want it to do it three ways if i can achieve it like i did?

this is a result with AB (apache-utils):
Server Software:
Server Hostname: ********
Server Port: 80

Document Path: /categorieen/blog/
Document Length: 37066 bytes

Concurrency Level: 10
Time taken for tests: 25.781 seconds
Complete requests: 140000
Failed requests: 0
Write errors: 0
Keep-Alive requests: 140000
Total transferred: 5246943484 bytes
HTML transferred: 5189280138 bytes
Requests per second: 5430.38 [#/sec] (mean)
Time per request: 1.841 [ms] (mean)
Time per request: 0.184 [ms] (mean, across all concurrent requests)
Transfer rate: 198750.56 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.0 0 1
Processing: 0 1 10.3 1 2232
Waiting: 0 0 10.3 0 2232
Total: 0 1 10.3 1 2233

Percentage of the requests served within a certain time (ms)
50% 1
66% 1
75% 1
80% 1
90% 1
95% 1
98% 1
99% 1
100% 2233 (longest request)

can i make it even quicker?
Re: Varnish using Nginx as reverse proxy
April 07, 2014 06:02PM
I came accross this thread looking up how to do exactly what you are wondering about.

The reason why a lot of people will set it up nginx -> varnish -> nginx is because varnish does not support ssl and they have no plans to ever support ssl. If you do not need https anywhere then there is no need to have nginx as a reverse proxy for varnish.

I do not understand the language the sites are in but from the looks of it they are setting it up so nginx can forward the request to two different ports. one for the sites and another for the apps. My guess is that varnish is only listening to one of them and something else is listening for the other.

likewise you could set it up so that you completly bypass varnish if using a specific port. This can be usefull for debugging but I would not recoomend it personally.



Edited 1 time(s). Last edit at 04/07/2014 06:03PM by yamiko.
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 206
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready