Varnish cache 擁有一個參數的集合,能夠影響varnish的行爲和性能。基本上全部的參數均可以在Varnish命令行接口(varnishadm)使用param.set關鍵詞來設置。安全
一些參數,處於安全的目的只讀的參數,只能使用-r參數來開啓。同時在varnishd的man手冊中也有相關的說明session
-r param[,param...] Make the listed parameters read only. This gives the system administrator a way to limit what the Varnish CLI can do. Consider making parameters such as user, group, cc_command, vcc_allow_inline_c read only as these can potentially be used to escalate privileges from the CLI. Protecting listen_address may also be a good idea.
咱們不建議你調整參數除非你肯定你作的是什麼。咱們努力的使用穩定的默認值,同時varnish使用默認設置應當能處理大多數的工做狀況。tcp
完整的參數列表能夠經過在命令行使用param.show來查看。ide
varnish> param.show 200 acceptor_sleep_decay 0.9 (default) acceptor_sleep_incr 0.001 [seconds] (default) acceptor_sleep_max 0.050 [seconds] (default) auto_restart on [bool] (default) ban_dups on [bool] (default) ban_lurker_age 60.000 [seconds] (default) ban_lurker_batch 1000 (default) ban_lurker_sleep 0.010 [seconds] (default) between_bytes_timeout 60.000 [seconds] (default) busyobj_worker_cache off [bool] (default) cc_command "exec gcc -std=gnu99 -O2 -g -Wp,-D_FORTIFY_SOURCE=0 -Wall -Werror -pthread -fpic -shared -Wl,-x -o %o %s" (default) cli_buffer 8k [bytes] (default) cli_limit 48k [bytes] (default) cli_timeout 60.000 [seconds] (default) clock_skew 10 [seconds] (default) connect_timeout 3.500 [seconds] (default) critbit_cooloff 180.000 [seconds] (default) debug none (default) default_grace 10.000 [seconds] (default) default_keep 0.000 [seconds] (default) default_ttl 120.000 [seconds] (default) feature none (default) fetch_chunksize 16k [bytes] (default) fetch_maxchunksize 0.25G [bytes] (default) first_byte_timeout 60.000 [seconds] (default) group GID 0 (default) group_cc <not set> (default) gzip_buffer 32k [bytes] (default) gzip_level 6 (default) gzip_memlevel 8 (default) http_gzip_support on [bool] (default) http_max_hdr 64 [header lines] (default) http_range_support on [bool] (default) http_req_hdr_len 8k [bytes] (default) http_req_size 32k [bytes] (default) http_resp_hdr_len 8k [bytes] (default) http_resp_size 32k [bytes] (default) idle_send_timeout 60.000 [seconds] (default) listen_address :80 (default) listen_depth 1024 [connections] (default) lru_interval 2.000 [seconds] (default) max_esi_depth 5 [levels] (default) max_restarts 4 [restarts] (default) max_retries 4 [retries] (default) nuke_limit 50 [allocations] (default) pcre_match_limit 10000 (default) pcre_match_limit_recursion 10000 (default) ping_interval 3 [seconds] (default) pipe_timeout 60.000 [seconds] (default) pool_req 10,100,10 (default) pool_sess 10,100,10 (default) pool_vbc 10,100,10 (default) pool_vbo 10,100,10 (default) prefer_ipv6 off [bool] (default) rush_exponent 3 [requests per request] (default) send_timeout 600.000 [seconds] (default) session_max 100000 [sessions] (default) shm_reclen 255b [bytes] (default) shortlived 10.000 [seconds] (default) sigsegv_handler off [bool] (default) syslog_cli_traffic on [bool] (default) tcp_keepalive_intvl 75.000 [seconds] (default) tcp_keepalive_probes 9 [probes] (default) tcp_keepalive_time 7200.000 [seconds] (default) thread_pool_add_delay 0.000 [seconds] (default) thread_pool_destroy_delay 1.000 [seconds] (default) thread_pool_fail_delay 0.200 [seconds] (default) thread_pool_max 1000 [threads] thread_pool_min 50 [threads] thread_pool_stack 48k [bytes] (default) thread_pool_timeout 120.000 [seconds] thread_pools 2 [pools] (default) thread_queue_limit 20 (default) thread_stats_rate 10 [requests] (default) timeout_idle 5.000 [seconds] (default) timeout_linger 0.050 [seconds] (default) timeout_req 2.000 [seconds] (default) user nobody (99) (default) vcc_allow_inline_c off [bool] (default) vcc_err_unref on [bool] (default) vcc_unsafe_path on [bool] (default) vcl_dir /etc/varnish (default) vmod_dir /usr/lib64/varnish/vmods (default) vsl_buffer 4k [bytes] (default) vsl_mask -VCL_trace,-WorkThread,-Hash (default) vsl_reclen 255b [bytes] (default) vsl_space 80M [bytes] (default) vsm_space 1M [bytes] (default) waiter epoll (possible values: epoll, poll) (default) workspace_backend 64k [bytes] (default) workspace_client 64k [bytes] (default) workspace_session 384b [bytes] (default) workspace_thread 2k [bytes] (default)
爲了檢查某一的參數和獲取參數的用法、描述、默認值,經過鍵入param.show 和參數名,像這樣:性能
varnish> param.show shortlived 200 shortlived 10.000000 [s] Default is 10.0 Objects created with TTL shorter than this are always put in transient storage. varnish> param.show thread_pools 200 thread_pools Value is: 2 [pools] (default) Default is: 2 Minimum is: 1 Number of worker thread pools. Increasing number of worker pools decreases lock contention. Too many pools waste CPU and RAM resources, and more than one pool for each CPU is probably detrimal to performance. Can be increased on the fly, but decreases require a restart to take effect. NB: This parameter may take quite some time to take (full) effect. NB: We do not know yet if it is a good idea to change this parameter, or if the default value is even sensible. Caution is advised, and feedback is most welcome.