Difference between pages "Subarches" and "Package:Varnish"

From Funtoo
(Difference between pages)
Jump to navigation Jump to search
 
m (add some c10k garbage)
 
Line 1: Line 1:
{{:Install/Header}}
{{Ebuild
= Funtoo Linux Sub-Architectures =
|Summary=Varnish is a state-of-the-art, high-performance HTTP accelerator
__NOTITLE__
|CatPkg=www-servers/varnish
This page provides an overview of Funtoo Linux sub-architectures (also called ''subarches'',) designed for quick and easy reference. While this information is available in other places, such as Wikipedia, it often takes some time to study and cross-reference the various articles to get a good understanding of each type of sub-architecture, and this information generally isn't all collected neatly in one place. That is the purpose of this page. When possible, links to more detailed Wikipedia pages are provided. You are encouraged to help maintain this page as well as the Wikipedia articles referenced here.
|Maintainer=
}}
__TOC__
'''Varnish''' is a webcache & http accelerator. Varnish will either serve cached content, or retireve content from the server, and cache it. Varnish will reduce I/O pressure from webservers.


== AMD Processors ==
==Install==
===Emerge===


=== amd64-k10 ===
Install {{Package|www-servers/varnish}}:
<console>###i## emerge www-servers/varnish</console>


The '''amd64-k10''' subarch provides support for the [[Wikipedia:AMD10h|AMD Family 10h processors]], which were released in late 2007 as a successor to the AMD K8 series processors.
==Configuration==


Desktop amd64-k10 CPUs include [[Wikipedia:AMD Phenom|AMD Phenom]], [[Wikipedia:AMD_10h#Phenom_II_Models|AMD Phenom II]] and [[Wikipedia:AMD_10h#Athlon_II_Models|AMD Athlon II]]. Server CPUs include Budapest, Barcelona, Suzuka, Shanghai, Istanbul, Lisbon, and Magny-Cours (a full listing of amd64-k10 Opterons  [[Wikipedia:List_of_AMD_Opteron_microprocessors#K10_based_Opterons|can be found here]].)
Configuration is controlled by /etc/varnish/default.vcl & /etc/conf.d/varnishd


=== amd64-bulldozer ===
{{file|name=/etc/varnish/default.vcl|desc=varnish configuration file|body=
vcl 4.0;
backend default {
    .host = "127.0.0.1";
    .port = "8080";
}
}}


The '''amd64-bulldozer''' subarch supports the [[Wikipedia:Bulldozer (microarchitecture)|AMD bulldozer microarchitecture]] CPUs, which were released from late 2011 through the first quarter of 2012 as a replacement for the [[Wikipedia:AMD10h|K10 microarchitecture]] CPUs.
{{file|name=/etc/conf.d/varnishd|desc=varnish configuration file|body=
Bulldozer CPUs use the [[Wikipedia:Socket_AM3+|AM3+ socket]] and [[Wikipedia:Socket_G34|G34 socket]] for server CPUs.
VARNISHD="/usr/sbin/varnishd"
VARNISHADM="/usr/bin/varnishadm"
CONFIGFILE="/etc/varnish/default.vcl"
VARNISHD_OPTS="-a 127.0.0.1:80"
VARNISHD_OPTS="${VARNISHD_OPTS} -u varnish -g varnish"
}}


Desktop bulldozer CPUs include the '''[[Wikipedia:List_of_AMD_FX_microprocessors#.22Zambezi.22_.2832_nm_SOI.29|Zambezi FX-series CPUs]]'''. Server bulldozer CPUs include '''Zurich''' (Opteron 3200-series), '''Valencia''' (Opteron 4200-series) and '''Interlagos''' (Opteron 6200 series). [[Wikipedia:http://en.wikipedia.org/wiki/Opteron#Opteron_.2832_nm_SOI.29-_First_Generation_Bulldozer_Microarchitecture|More information here.]].
Varnish will fetch data from localhost:8080 and serve accelerated proxy data on localhost:80


=== amd64-piledriver ===
=== c10k ===
For 10,000 concurrent connections (or not) a few configuration settings control the power of varnish.  If you're having varnish directly serve to the outside world, dial back concurrency to say 50 or 100 connections per ip. You must take into account corporations, and universities hammering several connections from a singular ip.  c10k is useful information for if varnish is behind a load balancer such as pound, nginx, or tengine, and all requests are internal and local.


The '''amd64-piledriver''' subarch supports the [[Wikipedia:Piledriver (microarchitecture)|AMD Piledriver microarchitecture]] produced by AMD from mid-2012 through 2015, which is the successor to the [[Wikipedia:Bulldozer (microarchitecture)|AMD bulldozer microarchitecture]].  
{{file|name=/etc/conf.d/varnishd|desc=varnish concurrency settings|body=
Piledriver CPUs and APUs are available that use the [[Wikipedia:FM2 Socket|FM2 socket]]. Desktop Piledriver CPUs use the [[Wikipedia:Socket_AM3+|AM3+ socket]]. Server Piledriver CPUs use a variety of sockets, including [[Wikipedia:Socket_AM3+|AM3+]], [[Wikipedia:Socket_C32|C32]] and [[Wikipedia:Socket_G34|G34]].
VARNISHD_OPTS="-a 127.0.0.1:80 -p thread_pool_min=20 -p thread_pool_max=1000 -p thread_pool_add_delay=2 -s malloc,700M"
}}


Desktop piledriver CPU and APUs include '''Vishera''' (FX-8350, FX-8370),  '''[[Wikipedia:List_of_AMD_accelerated_processing_unit_microprocessors#Virgo:_.22Trinity.22_.282012.2C_32_nm.29|Trinity A-series APUs]]''' (A6-5400K, A10-5800K) and '''[[Wikipedia:http://en.wikipedia.org/wiki/List_of_AMD_accelerated_processing_unit_microprocessors#.22Richland.22_.282013.2C_32_nm.29_2|Richland A-series APUs]]'''.  
{{file|name=/etc/varnish/default.vcl|desc=varnish concurrency settings|body=
backend default {
    .host = "127.0.0.1";
    .port = "8080";
    .connect_timeout = 600s;
    .first_byte_timeout = 600s;
    .between_bytes_timeout = 600s;
    .max_connections = 10000;
    # .port = "80" led to issues with competing for the port with apache.
}
}}


Server piledriver CPUs include '''Delhi''' (Opteron 3300-series, [[Wikipedia:Socket_AM3+|AM3+]]), '''Seoul''' (Opteron 4300-series, [[Wikipedia:Socket_C32|C32]])  and '''Abu Dhabi''' (Opteron 6300-series, [[Wikipedia:Socket_G34|G34]]). [[Wikipedia:Opteron#Opteron_.2832_nm_SOI.29_-_Piledriver_Microarchitecture|More information here]].
== BootService ==


Piledriver adds several new instructions over bulldozer, so AMD bulldozer systems cannot run amd64-piledriver-optimized stages. However, this subarch is  instruction-compatible with its successor, the, so amd64-piledriver stages can run on amd64-steamroller systems, and vice versa.
To start varnish immediately:
<console>###i## rc-service varnishd start</console>


=== amd64-steamroller ===
To start varnish at boot:
<console>###i## rc-update add varnishd default</console>


The '''amd64-steamroller''' subarch supports the  [[Wikipedia:Steamroller (microarchitecture)|AMD steamroller microarchitecture]], produced from early 2014. It is the successor to the [[Wikipedia:Piledriver (microarchitecture)|AMD Piledriver microarchitecture]].
== Verification ==
Steamroller APUs are available that use the [[Wikipedia:FM2+ Socket|FM2+ socket]] and  [[Wikipedia:Socket_FP3|FP3 socket]] (mobile.)
To verify that your traffic is going through varnish.
<console>$##i## curl -I https://www.varnish-cache.org/</console>


Desktop steamroller APUs include the '''[[Wikipedia:AMD_Accelerated_Processing_Unit#Steamroller_architecture_.282014.29:_Kaveri|Kaveri A-Series APUs]]''', such as the quad-core AMD A10-7850K APU. Steamroller APUs are also available in mobile versions. Server steamroller APUs include the '''Berlin APUs''', which are not yet released.
== Benchmarking ==
If your system has apache installed apache benchmark can show the power of varnish. The examples shown are running 500 requests with concurrency of 100 hits.


Amd64-steamroller subarches are instruction-compatible with amd64-piledriver, but add new instructions over amd64-bulldozer.


=== amd64-jaguar ===
ab against a 3 worker cluster mode puma server
<console>###i## ab -n 500 -c 100 http://127.0.0.1:3000/index.html | grep Request</console>
Requests per second:    110.92 [#/sec] (mean)


The '''amd64-jaguar''' (also called AMD Family 16h) subarch supports the  [[Wikipedia:Jaguar (microarchitecture)|AMD jaguar microarchitecture]], which is targeted at low-power devices, including notebooks, tablets and small form-factor desktops and servers. It is perhaps most well-known for being the microarchitecture used for the [[Wikipedia:Playstation 4|Playstation 4]] and [[Wikipedia:Xbox One|Xbox One]], which each use custom 8-core Jaguar APUs.
Socketed Jaguar APUs use the [[Wikipedia:AM1 Socket|AM1 socket]] and  [[Wikipedia:Socket_FT3|FT3 socket]] for mobile devices. G-series [[Wikipedia:System_on_a_chip|"system on a chip" (SoC)]] APUs are available for non-socketed devices such as tablets and embedded system boards.


Desktop Jaguar APUs include the '''[[Wikipedia:List_of_AMD_accelerated_processing_unit_microprocessors#.22Kabini.22.2C_.22Temash.22_.282013.2C_28_nm.29|Kabini A-series APUs and Temash E-series APUs]]''', Athlon 5150 and 5350 APUs, and Sempron 2650 and 3850.
ab against the same server served through varnish
<console>###i## ab -n 500 -c 100 http://127.0.0.1/index.html | grep Request</console>
Requests per second:    10268.42 [#/sec] (mean)


Amd64-jaguar subarches use the MOVBE instruction which is not available on amd64-bulldozer, amd64-piledriver or amd64-steamroller. They are thus not instruction-compatible with any of these subarches.
== SSL support ==
{{:Install/Footer}}
Varnish does not support ssl. There are packages to get around this limitation:
* {{package|stunnel}}
* {{package|pound}}
 
== Media ==
{{#widget:YouTube16x9|id=JEF6_XC-2ZU}}
 
{{EbuildFooter}}

Revision as of 05:13, November 16, 2014

Varnish

   Tip

We welcome improvements to this page. To edit this page, Create a Funtoo account. Then log in and then click here to edit this page. See our editing guidelines to becoming a wiki-editing pro.


Varnish is a webcache & http accelerator. Varnish will either serve cached content, or retireve content from the server, and cache it. Varnish will reduce I/O pressure from webservers.

Install

Emerge

Install www-servers/varnish:

root # emerge www-servers/varnish

Configuration

Configuration is controlled by /etc/varnish/default.vcl & /etc/conf.d/varnishd

   /etc/varnish/default.vcl - varnish configuration file
vcl 4.0;
backend default {
    .host = "127.0.0.1";
    .port = "8080";
}
   /etc/conf.d/varnishd - varnish configuration file
VARNISHD="/usr/sbin/varnishd"
VARNISHADM="/usr/bin/varnishadm"
CONFIGFILE="/etc/varnish/default.vcl"
VARNISHD_OPTS="-a 127.0.0.1:80"
VARNISHD_OPTS="${VARNISHD_OPTS} -u varnish -g varnish"

Varnish will fetch data from localhost:8080 and serve accelerated proxy data on localhost:80

c10k

For 10,000 concurrent connections (or not) a few configuration settings control the power of varnish. If you're having varnish directly serve to the outside world, dial back concurrency to say 50 or 100 connections per ip. You must take into account corporations, and universities hammering several connections from a singular ip. c10k is useful information for if varnish is behind a load balancer such as pound, nginx, or tengine, and all requests are internal and local.

   /etc/conf.d/varnishd - varnish concurrency settings
VARNISHD_OPTS="-a 127.0.0.1:80 -p thread_pool_min=20 -p thread_pool_max=1000 -p thread_pool_add_delay=2 -s malloc,700M"
   /etc/varnish/default.vcl - varnish concurrency settings
backend default {
    .host = "127.0.0.1";
    .port = "8080";
    .connect_timeout = 600s;
    .first_byte_timeout = 600s;
    .between_bytes_timeout = 600s;
    .max_connections = 10000;
    # .port = "80" led to issues with competing for the port with apache.
}

BootService

To start varnish immediately:

root # rc-service varnishd start

To start varnish at boot:

root # rc-update add varnishd default

Verification

To verify that your traffic is going through varnish.

user $ curl -I https://www.varnish-cache.org/

Benchmarking

If your system has apache installed apache benchmark can show the power of varnish. The examples shown are running 500 requests with concurrency of 100 hits.


ab against a 3 worker cluster mode puma server

root # ab -n 500 -c 100 http://127.0.0.1:3000/index.html | grep Request

Requests per second: 110.92 [#/sec] (mean)


ab against the same server served through varnish

root # ab -n 500 -c 100 http://127.0.0.1/index.html | grep Request

Requests per second: 10268.42 [#/sec] (mean)

SSL support

Varnish does not support ssl. There are packages to get around this limitation:

  • No results
  • No results

Media