Created
October 18, 2011 22:27
-
-
Save seanhess/1296924 to your computer and use it in GitHub Desktop.
varnish dropping
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
exports.createServer = function() { | |
var http = require('http'); | |
return http.createServer(function (req, res) { | |
console.log("req") | |
res.writeHead(200, {'Content-Type': 'text/plain', 'Cache-Control': 'no-cache'}); | |
res.end('Hello World\n'); | |
}) | |
} | |
if (module == require.main) { | |
exports.createServer().listen(1337); | |
console.log('Server running at http://127.0.0.1:1337/'); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
director example round-robin { | |
{ | |
.backend = { | |
.host = "10.183.4.80"; | |
.port = "1337"; | |
.probe = { | |
.url = "/"; | |
.interval = 5s; | |
.timeout = 1 s; | |
.window = 5; | |
.threshold = 3; | |
} | |
} | |
} | |
{ | |
.backend = { | |
.host = "10.183.4.149"; | |
.port = "1337"; | |
.probe = { | |
.url = "/"; | |
.interval = 5s; | |
.timeout = 1 s; | |
.window = 5; | |
.threshold = 3; | |
} | |
} | |
} | |
} | |
sub vcl_recv { | |
# Use our backend | |
set req.backend = example; | |
} | |
sub vcl_fetch { | |
# Don't cache anything | |
return (pass); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# WE ARE USING VARNISH 2.1.5, please use remote <server> setup to config the server | |
# Configuration file for varnish | |
# | |
# /etc/init.d/varnish expects the variable $DAEMON_OPTS to be set from this | |
# shell script fragment. | |
# | |
# Maximum number of open files (for ulimit -n) | |
NFILES=131072 | |
# Locked shared memory (for ulimit -l) | |
# Default log size is 82MB + header | |
MEMLOCK=82000 | |
# Maximum size of corefile (for ulimit -c). Default in Fedora is 0 | |
# DAEMON_COREFILE_LIMIT="unlimited" | |
# Set this to 1 to make init script reload try to switch vcl without restart. | |
# To make this work, you need to set the following variables | |
# explicit: VARNISH_VCL_CONF, VARNISH_ADMIN_LISTEN_ADDRESS, | |
# VARNISH_ADMIN_LISTEN_PORT, VARNISH_SECRET_FILE, or in short, | |
# use Alternative 3, Advanced configuration, below | |
RELOAD_VCL=1 | |
# This file contains 4 alternatives, please use only one. | |
## Alternative 1, Minimal configuration, no VCL | |
# | |
# Listen on port 6081, administration on localhost:6082, and forward to | |
# content server on localhost:8080. Use a fixed-size cache file. | |
# | |
#DAEMON_OPTS="-a :6081 \ | |
# -T localhost:6082 \ | |
# -b localhost:8080 \ | |
# -u varnish -g varnish \ | |
# -s file,/var/lib/varnish/varnish_storage.bin,1G" | |
## Alternative 2, Configuration with VCL | |
# | |
# Listen on port 6081, administration on localhost:6082, and forward to | |
# one content server selected by the vcl file, based on the request. Use a | |
# fixed-size cache file. | |
# | |
#DAEMON_OPTS="-a :6081 \ | |
# -T localhost:6082 \ | |
# -f /etc/varnish/default.vcl \ | |
# -u varnish -g varnish \ | |
# -S /etc/varnish/secret \ | |
# -s file,/var/lib/varnish/varnish_storage.bin,1G" | |
## Alternative 3, Advanced configuration | |
# | |
# See varnishd(1) for more information. | |
# | |
# # Main configuration file. You probably want to change it :) | |
VARNISH_VCL_CONF=/etc/varnish/itv.vcl | |
# | |
# # Default address and port to bind to | |
# # Blank address means all IPv4 and IPv6 interfaces, otherwise specify | |
# # a host name, an IPv4 dotted quad, or an IPv6 address in brackets. | |
# VARNISH_LISTEN_ADDRESS= | |
VARNISH_LISTEN_PORT=80 | |
# # Telnet admin interface listen address and port | |
VARNISH_ADMIN_LISTEN_ADDRESS=127.0.0.1 | |
VARNISH_ADMIN_LISTEN_PORT=6082 | |
# | |
# # Shared secret file for admin interface | |
VARNISH_SECRET_FILE=/etc/varnish/secret | |
# | |
# # The minimum number of worker threads to start | |
VARNISH_MIN_THREADS=100 | |
# | |
# # The Maximum number of worker threads to start | |
VARNISH_MAX_THREADS=4000 | |
# | |
# # Idle timeout for worker threads | |
VARNISH_THREAD_TIMEOUT=120 | |
# | |
# # Cache file location | |
VARNISH_STORAGE_FILE=/var/lib/varnish/varnish_storage.bin | |
# | |
# # Cache file size: in bytes, optionally using k / M / G / T suffix, | |
# # or in percentage of available disk space using the % suffix. | |
VARNISH_STORAGE_SIZE=3G | |
# | |
# # Backend storage specification | |
VARNISH_STORAGE="file,${VARNISH_STORAGE_FILE},${VARNISH_STORAGE_SIZE}" | |
# | |
# # Default TTL used when the backend does not specify one | |
VARNISH_TTL=120 | |
# # DAEMON_OPTS is used by the init script. If you add or remove options, make | |
# # sure you update this section, too. | |
DAEMON_OPTS="-a ${VARNISH_LISTEN_ADDRESS}:${VARNISH_LISTEN_PORT} \ | |
-f ${VARNISH_VCL_CONF} \ | |
-T ${VARNISH_ADMIN_LISTEN_ADDRESS}:${VARNISH_ADMIN_LISTEN_PORT} \ | |
-t ${VARNISH_TTL} \ | |
-w ${VARNISH_MIN_THREADS},${VARNISH_MAX_THREADS},${VARNISH_THREAD_TIMEOUT} \ | |
-p thread_pools=4 \ | |
-p thread_pool_add_delay=2 \ | |
-p session_linger=150 \ | |
-p sess_timeout=60 \ | |
-u varnish -g varnish \ | |
-S ${VARNISH_SECRET_FILE} \ | |
-s ${VARNISH_STORAGE}" \ | |
# | |
## Alternative 4, Do It Yourself. See varnishd(1) for more information. | |
# | |
# DAEMON_OPTS="" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
0+00:00:52 fake1 | |
Hitrate ratio: 3 3 3 | |
Hitrate avg: 0.0000 0.0000 0.0000 | |
33266 0.00 639.73 Client connections accepted | |
33266 0.00 639.73 Client requests received | |
33263 0.00 639.67 Cache hits for pass | |
3 0.00 0.06 Cache misses | |
44 0.00 0.85 Backend conn. success | |
33222 0.00 638.88 Backend conn. reuses | |
33266 0.00 639.73 Backend conn. recycles | |
33266 0.00 639.73 Fetch chunked | |
68 . . N struct sess_mem | |
1 . . N struct sess | |
3 . . N struct object | |
64 . . N struct objectcore | |
64 . . N struct objecthead | |
10 . . N struct smf | |
0 . . N small free smf | |
4 . . N large free smf | |
44 . . N struct vbe_conn | |
400 . . N worker threads | |
400 0.00 7.69 N worker threads created | |
338 0.00 6.50 N worker threads limited | |
2 . . N backends | |
33266 0.00 639.73 Objects sent with write | |
33266 0.00 639.73 Total Sessions | |
33266 0.00 639.73 Total Requests | |
33263 0.00 639.67 Total pass | |
33266 0.00 639.73 Total fetch | |
6619929 0.00 127306.33 Total header bytes | |
399192 0.00 7676.77 Total body bytes | |
33264 0.00 639.69 Session Closed | |
33265 0.00 639.71 Session Linger | |
2 0.00 0.04 Session herd | |
1896687 2.00 36474.75 SHM records | |
200065 2.00 3847.40 SHM writes | |
329 0.00 6.33 SHM MTX contention | |
33269 0.00 639.79 allocator requests | |
6 . . outstanding allocations | |
24576 . . bytes allocated | |
3221200896 . . bytes free | |
33266 0.00 639.73 Backend requests made | |
1 0.00 0.02 N vcl total | |
1 0.00 0.02 N vcl available | |
1 . . N total active purges | |
1 0.00 0.02 N new purges added | |
33266 0.00 639.73 HCB Lookups without lock | |
3 0.00 0.06 HCB Lookups with lock | |
3 0.00 0.06 HCB Inserts | |
52 1.00 1.00 Client uptime |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
0+00:00:17 fake1 | |
Hitrate ratio: 1 1 1 | |
Hitrate avg: 0.0000 0.0000 0.0000 | |
6878 1798.94 404.59 Client connections accepted | |
6876 1798.94 404.47 Client requests received | |
6875 1798.94 404.41 Cache hits for pass | |
1 0.00 0.06 Cache misses | |
11 0.00 0.65 Backend conn. success | |
6867 1798.94 403.94 Backend conn. reuses | |
6878 1800.94 404.59 Backend conn. recycles | |
6876 1798.94 404.47 Fetch chunked | |
22 . . N struct sess_mem | |
2 . . N struct sess | |
1 . . N struct object | |
17 . . N struct objectcore | |
17 . . N struct objecthead | |
6 . . N struct smf | |
4 . . N large free smf | |
11 . . N struct vbe_conn | |
400 . . N worker threads | |
400 0.00 23.53 N worker threads created | |
338 0.00 19.88 N worker threads limited | |
2 . . N backends | |
6878 1800.94 404.59 Objects sent with write | |
6876 1798.94 404.47 Total Sessions | |
6876 1798.94 404.47 Total Requests | |
6875 1798.94 404.41 Total pass | |
6876 1798.94 404.47 Total fetch | |
1368324 357989.36 80489.65 Total header bytes | |
82512 21587.30 4853.65 Total body bytes | |
6876 1798.94 404.47 Session Closed | |
6876 1798.94 404.47 Session Linger | |
392483 102605.55 23087.24 SHM records | |
41695 10797.64 2452.65 SHM writes | |
49 17.97 2.88 SHM MTX contention | |
6879 1799.94 404.65 allocator requests | |
2 . . outstanding allocations | |
8192 . . bytes allocated | |
3221217280 . . bytes free | |
6878 1798.94 404.59 Backend requests made | |
1 0.00 0.06 N vcl total | |
1 0.00 0.06 N vcl available | |
1 . . N total active purges | |
1 0.00 0.06 N new purges added | |
6878 1798.94 404.59 HCB Lookups without lock | |
1 0.00 0.06 HCB Lookups with lock | |
1 0.00 0.06 HCB Inserts | |
17 1.00 1.00 Client uptime |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment