varnish cache 4.0 / redpill linpro breakfast in oslo

Post on 17-Dec-2014

224 Views

Category:

Technology

1 Downloads

Preview:

Click to see full reader

DESCRIPTION

Whats new in Varnish Cache 4.0. Threads, streaming, logging.

TRANSCRIPT

Varnish Cache 4.0Whats new

Varnish 3.0

• Released in 2011

• Added modules

• gzip

• basic streaming capabilities

Security in V4

• -r for read only parameters

• Locks down CLI

• user, group and cc_command

• Inline C is default off

Threading in Varnish 4

Clientthread

Backend thread

Varnish Cache

Client Web server

Varnish Cache

Grace in V4

Clientthread

Backend thread

Client Web server

GET /stale-object

Varnish Cache

Grace in V4

Clientthread

Backend thread

Client Web serverStale object

delivered

Background fetch scheduled

Varnish Cache

Grace in V4

Clientthread

Backend thread

Client Web server

Object refreshed

Streaming

• V3 will add a bit of delay before starting delivery on cache misses

• From “store and forward” to “cut through”

• Set do_stream = true in V4

• Beneficial for large objects and cache hierarchies

Streaming in Varnish

Backend thread

Varnish Cache

Web server

ClientClientthread

ClientClientthread

Client

Clientthread

GET /big-object-to-be-streamed

Upcoming in V4 Plus

• New storage backend

• Supports >1TB of storage

• Persists cache across crash/reboot

• Highly performant on SSDs

• Only available in Varnish Plus

Logging in V3

• Logging in V3 is limited

• Only regex matching using &&

• No req/bereq relationship

• Performance problems

• Transactions and transactions groups

• Query language

• Output control

• Increased performance (zero copy)

Logging in V4

Log transactions

• On work item for Varnish

• client request

• backend request

• ESI sub-request

• session

Transactions groups

• Transactions (work items) can be grouped

• by VXID

• by request

• by session

• raw varnishlog -g (vxid | request | session | raw )

Log query language"$ varnishlog -g request \

-q 'ReqURL eq "/"' """$ varnishlog -g request \

-q 'Backend ~ default'

* << Request >> 32770 - Begin req 32769 - ReqMethod GET- ReqURL /- ReqProtocol HTTP/1.1 - ReqHeader TE: deflate,gzip;q=0.3 ... - Link bereq 32771 - VCL_call DELIVER - VCL_return deliver - RespProtocol HTTP/1.1 - RespStatus 200 - RespResponse OK - ReqEnd 1385330985.979025126 1385330985.978960991 -0.001315594 0.001251459 -0.001315594 - End ** << BeReq >> 32771 -- Begin bereq 32770 -- VCL_call BACKEND_FETCH -- VCL_return fetch -- BackendOpen 18 default(127.0.0.1,::1,8020) 127.0.0.1 45989 -- Backend 18 default default(127.0.0.1,::1,8020) -- BereqMethod GET -- BereqURL / -- BereqEnd 1385330985.979187250 1385330985.980367422 0.000082792 0.000496101 0.000326045 0.000822146-- End

Examples"

String matching, negation, logical operations

not (RespProtocol eq “HTTP/1.1”) or (RespProtcol eq “HTTP/1.0”))!

Regular expressions

! ReqMethod !~ "GET|POST"!

Integer matching

! (RespStatus >= 200 and RespStatus < 300)!

Float matching

! Timestamp:Process[2] > 0.5

Mind blown?

Output control

• A bit like “grep” for varnishlog

• Applied last, doesn’t affect queries

• -i <taglist> / -I <taglist:regex>

• -x <taglist> / -X <taglist:regex>

• Taglists supports globbing (e.g. Req*)

Load balancing

• Mostly feature parity… however

• Directors are VMODs now

• Directors typically defined in vcl_init

• Easy to implement new directors

• Directors are now stackable

Summing up

• Streaming is much improved in V4

• New mind blowing logging facility

• Backend/frontend threading

• IMS towards backend

• Performance increase

• VCL changes

• Reworked documentation (varnish.org/docs)

Other neat stuff

• Auto-tuner coming to Varnish Cache Plus

• Clustering for Varnish Cache Plus

• Real time analytics (VCS)

Thank you!

perbu@varnish-software.com

twitter.com/perbu

top related