SlideShare ist ein Scribd-Unternehmen logo
1 von 33
Copyright © GREE, Inc. All Rights Reserved.Copyright © GREE, Inc. All Rights Reserved.
Lost in Translation:
varnishlog, varnishtest
~The Story of a Successful Migration~
GREE, inc.
Shohei Tanaka
Varnish User Group Meeting 7
Friday, May 31st 2013
Copyright © GREE, Inc. All Rights Reserved.
Who am I
Shohei Tanaka (@xcir)
- Call me iwana-chan
- GREE, inc.
- Joined 2013/01~
- Tokyo, Japan
- Activities at varnish project
- VMOD author
- ldap, redirect, parsereq, awsrest and more..
- Wrote Japanese Varnish guidebook
- Other
- blog http://blog.xcir.net/
- github http://github.com/xcir/
Copyright © GREE, Inc. All Rights Reserved.
Migration from legacy system
Finished without any downtime
- Platform downtime was not an option
- Domain / backend has more than a hundred columns
- Very high
- Traffic
- Connection/sec
- Request/sec
- Many target device types
- PC
- Smartphone
- Mobile phone (No support for keep-alive)
Copyright © GREE, Inc. All Rights Reserved.
New system
Server layout
- 3 layer model
- Use Hash director
- Objects won't be
duplicated
across L2 pool
- ImageOperation
- Apache + Varnish
- Create thumbs
- mod_small_light
- Generate barcode(QR)
- GREE original
Copyright © GREE, Inc. All Rights Reserved.
New system
VCL layout
- Common settings
- Same for all server roles
- Security, ACL, Normalize....
- Individual server role settings
- Backend, Rewrite...
- Divide action by
- Type (categorized domain)
- Domain (can't categorize)
Copyright © GREE, Inc. All Rights Reserved.
Why Varnish?
GREE had never used it
- VCL
- Very powerful DSL
- Fits into existing system
- Healthcheck
- Varnishtest
- Can define the behavior of the server, client, varnish.
- Useful tools
- varnishncsa and varnishlog are very useful
- libvarnishapi can connect to VSL easily
- And I love Varnish ;-)
Copyright © GREE, Inc. All Rights Reserved.
Testing, Testing, Testing!
We used varnishtest
- Different package for common and server roles
- Unit tests for common settings
- Integration tests for common + server role
Copyright © GREE, Inc. All Rights Reserved.
varnishtest(failed log)
I love it, but it's difficult to read
Copyright © GREE, Inc. All Rights Reserved.
varnishtest(failed log)
I love it, but it's difficult to read
Copyright © GREE, Inc. All Rights Reserved.
vtctrans.py
Human readable ;)
- Sort by
- Event
- Error output
- Header and expected result
- Macro define
https://github.com/xcir/vtctrans
Copyright © GREE, Inc. All Rights Reserved.
Screenshot
Event
varnishtest
vtctrans
Copyright © GREE, Inc. All Rights Reserved.
Screenshot
Event
varnishtest
vtctrans
Copyright © GREE, Inc. All Rights Reserved.
Screenshot
Macro list
varnishtest
vtctrans
Copyright © GREE, Inc. All Rights Reserved.
Screenshot
Macro list
varnishtest
vtctrans
Copyright © GREE, Inc. All Rights Reserved.
Screenshot
Header and expected result
vtctrans varnishtest
Copyright © GREE, Inc. All Rights Reserved.
Screenshot
Header and expected result
vtctrans varnishtest
Copyright © GREE, Inc. All Rights Reserved.
Performance tuning
Measure, don't guess
- Nevertheless, capacity planning is important :)
- runtime parameters
- server specs, placement
- fault tolerance (keep service up even when a rack fails)
- Measure with production servers, it's the most important
thing
- Useful commands
- varnishncsa -m "txstatus:^[45]"
- varnishstat
- varnishhist -m "rxheader:Host: foo"
- varnishlog -m "rxurl:/foo/bar"
- Used varnishncsa and varnishlog alot
Copyright © GREE, Inc. All Rights Reserved.
varnishlog
ugly
Copyright © GREE, Inc. All Rights Reserved.
vsltrans.py(old:vltrans.php)
beautiful!
- Sort by
- Error output
- VCL action
- variable
- hash and vary
- can use multiple -m option
https://github.com/xcir/vsltrans
Copyright © GREE, Inc. All Rights Reserved.
Screenshot
General, Error, Hash, Vary info
vsltrans
and more...
varnishlog
Copyright © GREE, Inc. All Rights Reserved.
Screenshot
General, Error, Hash, Vary info
vsltrans
and more...
varnishlog
Copyright © GREE, Inc. All Rights Reserved.
Screenshot
Action
vsltrans
varnishlog
Copyright © GREE, Inc. All Rights Reserved.
Screenshot
Action
vsltrans
varnishlog
Copyright © GREE, Inc. All Rights Reserved.
Screenshot
Variable
vsltrans
varnishlog
Copyright © GREE, Inc. All Rights Reserved.
Screenshot
Variable
vsltrans
varnishlog
Copyright © GREE, Inc. All Rights Reserved.
More measurements
- By different host
- Cache hit rate
- Transfer size per sec
- Request per sec
- By directory (specify depth)
- Cache hit rate
- Transfer size per sec
- Request per sec
- And more...
Copyright © GREE, Inc. All Rights Reserved.
Why do we need a detailed
measurements?
- Hit rate is summarized by default
- Different costs for different objects
- Dynamic object: high cost
- Static object: low cost
- It's necessary to separate results by object cost
- Need to consider system cost instead of just
Varnish hit rate
- However you cannot do this with just the default
commands
That's where libvarnishapi comes in
Copyright © GREE, Inc. All Rights Reserved.
libvarnishapi.so
- VSL access is easy with libvarnishapi
- uses varnishlog, varnishncsa
- Used Python ctypes and it proved to be very simple to use
- Sample code
https://github.com/xcir/python-varnishapi
Copyright © GREE, Inc. All Rights Reserved.
python-varnishapi sample
- VSL data output sample
- Made it slightly more readable ;)
Copyright © GREE, Inc. All Rights Reserved.
python-varnishapi sample
Copyright © GREE, Inc. All Rights Reserved.
python-varnishapi sample
Copyright © GREE, Inc. All Rights Reserved.
libvarnishapi: very easy to use
Hack on with libvarnishapi and Varnish!
Better than making a measuring tool
from scratch
Copyright © GREE, Inc. All Rights Reserved.
Thank you for your
attention!
Any Questions?
@xcir
http://blog.xcir.net/
https://github.com/xcir/vtctrans
https://github.com/xcir/vsltrans
https://github.com/xcir/python-varnishapi

Weitere ähnliche Inhalte

Ähnlich wie Lost in Translation:varnishlog, varnishtest(VUG7)

What's New and Newer in Apache httpd-24
What's New and Newer in Apache httpd-24What's New and Newer in Apache httpd-24
What's New and Newer in Apache httpd-24Jim Jagielski
 
Lessons Learned in Automating Compliance for Containers
Lessons Learned in Automating Compliance for ContainersLessons Learned in Automating Compliance for Containers
Lessons Learned in Automating Compliance for ContainersAll Things Open
 
What does Serverless mean for tomorrow’s abstracted infrastructure? - Gadi Na...
What does Serverless mean for tomorrow’s abstracted infrastructure? - Gadi Na...What does Serverless mean for tomorrow’s abstracted infrastructure? - Gadi Na...
What does Serverless mean for tomorrow’s abstracted infrastructure? - Gadi Na...DevOpsDays Tel Aviv
 
Apache HTTPD 2.4 Reverse Proxy: The Hidden Gem
Apache HTTPD 2.4 Reverse Proxy: The Hidden GemApache HTTPD 2.4 Reverse Proxy: The Hidden Gem
Apache HTTPD 2.4 Reverse Proxy: The Hidden GemJim Jagielski
 
Building Secure Services using Containers
Building Secure Services using ContainersBuilding Secure Services using Containers
Building Secure Services using ContainersAmazon Web Services
 
Webrtc plugins for Desktop Browsers
Webrtc plugins for Desktop BrowsersWebrtc plugins for Desktop Browsers
Webrtc plugins for Desktop BrowsersAlexandre Gouaillard
 
Advanced Container Security - AWS Summit Sydney 2018
Advanced Container Security - AWS Summit Sydney 2018Advanced Container Security - AWS Summit Sydney 2018
Advanced Container Security - AWS Summit Sydney 2018Amazon Web Services
 
AWS에서 Kubernetes 실전 활용하기::유병우::AWS Summit Seoul 2018
AWS에서 Kubernetes 실전 활용하기::유병우::AWS Summit Seoul 2018AWS에서 Kubernetes 실전 활용하기::유병우::AWS Summit Seoul 2018
AWS에서 Kubernetes 실전 활용하기::유병우::AWS Summit Seoul 2018Amazon Web Services Korea
 
Dark side of the reflect
Dark side of the reflectDark side of the reflect
Dark side of the reflectsairoutine
 
Qualcomm Snapdragon Processors: A Super Gaming Platform
Qualcomm Snapdragon Processors: A Super Gaming Platform Qualcomm Snapdragon Processors: A Super Gaming Platform
Qualcomm Snapdragon Processors: A Super Gaming Platform Qualcomm Developer Network
 
UplinQ - qualcomm® snapdragon™ processors a super gaming platform
UplinQ - qualcomm® snapdragon™ processors a super gaming platformUplinQ - qualcomm® snapdragon™ processors a super gaming platform
UplinQ - qualcomm® snapdragon™ processors a super gaming platformSatya Harish
 
Java script anywhere. What Nombas was doing pre-acquisition.
Java script anywhere. What Nombas was doing pre-acquisition.Java script anywhere. What Nombas was doing pre-acquisition.
Java script anywhere. What Nombas was doing pre-acquisition.Brent Noorda
 
Safe peak installation guide version 2.1
Safe peak installation guide version 2.1Safe peak installation guide version 2.1
Safe peak installation guide version 2.1Vladi Vexler
 
Asynchronous architecture (Node.js & Vert.x)
Asynchronous architecture (Node.js & Vert.x)Asynchronous architecture (Node.js & Vert.x)
Asynchronous architecture (Node.js & Vert.x)Yu Kwangjong
 
Apache httpd 2.4 Reverse Proxy: The Hidden Gem
Apache httpd 2.4 Reverse Proxy: The Hidden GemApache httpd 2.4 Reverse Proxy: The Hidden Gem
Apache httpd 2.4 Reverse Proxy: The Hidden GemJim Jagielski
 
Geode is Not a Cache, it's an Analytics Engine
Geode is Not a Cache, it's an Analytics EngineGeode is Not a Cache, it's an Analytics Engine
Geode is Not a Cache, it's an Analytics EngineVMware Tanzu
 
VUG5: Varnish at Opera Software
VUG5: Varnish at Opera SoftwareVUG5: Varnish at Opera Software
VUG5: Varnish at Opera SoftwareCosimo Streppone
 

Ähnlich wie Lost in Translation:varnishlog, varnishtest(VUG7) (20)

Container Security
Container SecurityContainer Security
Container Security
 
Online spanish meetup #2
Online spanish meetup #2Online spanish meetup #2
Online spanish meetup #2
 
What's New and Newer in Apache httpd-24
What's New and Newer in Apache httpd-24What's New and Newer in Apache httpd-24
What's New and Newer in Apache httpd-24
 
T5 Oli Aro
T5 Oli AroT5 Oli Aro
T5 Oli Aro
 
Lessons Learned in Automating Compliance for Containers
Lessons Learned in Automating Compliance for ContainersLessons Learned in Automating Compliance for Containers
Lessons Learned in Automating Compliance for Containers
 
What does Serverless mean for tomorrow’s abstracted infrastructure? - Gadi Na...
What does Serverless mean for tomorrow’s abstracted infrastructure? - Gadi Na...What does Serverless mean for tomorrow’s abstracted infrastructure? - Gadi Na...
What does Serverless mean for tomorrow’s abstracted infrastructure? - Gadi Na...
 
Apache HTTPD 2.4 Reverse Proxy: The Hidden Gem
Apache HTTPD 2.4 Reverse Proxy: The Hidden GemApache HTTPD 2.4 Reverse Proxy: The Hidden Gem
Apache HTTPD 2.4 Reverse Proxy: The Hidden Gem
 
Building Secure Services using Containers
Building Secure Services using ContainersBuilding Secure Services using Containers
Building Secure Services using Containers
 
Webrtc plugins for Desktop Browsers
Webrtc plugins for Desktop BrowsersWebrtc plugins for Desktop Browsers
Webrtc plugins for Desktop Browsers
 
Advanced Container Security - AWS Summit Sydney 2018
Advanced Container Security - AWS Summit Sydney 2018Advanced Container Security - AWS Summit Sydney 2018
Advanced Container Security - AWS Summit Sydney 2018
 
AWS에서 Kubernetes 실전 활용하기::유병우::AWS Summit Seoul 2018
AWS에서 Kubernetes 실전 활용하기::유병우::AWS Summit Seoul 2018AWS에서 Kubernetes 실전 활용하기::유병우::AWS Summit Seoul 2018
AWS에서 Kubernetes 실전 활용하기::유병우::AWS Summit Seoul 2018
 
Dark side of the reflect
Dark side of the reflectDark side of the reflect
Dark side of the reflect
 
Qualcomm Snapdragon Processors: A Super Gaming Platform
Qualcomm Snapdragon Processors: A Super Gaming Platform Qualcomm Snapdragon Processors: A Super Gaming Platform
Qualcomm Snapdragon Processors: A Super Gaming Platform
 
UplinQ - qualcomm® snapdragon™ processors a super gaming platform
UplinQ - qualcomm® snapdragon™ processors a super gaming platformUplinQ - qualcomm® snapdragon™ processors a super gaming platform
UplinQ - qualcomm® snapdragon™ processors a super gaming platform
 
Java script anywhere. What Nombas was doing pre-acquisition.
Java script anywhere. What Nombas was doing pre-acquisition.Java script anywhere. What Nombas was doing pre-acquisition.
Java script anywhere. What Nombas was doing pre-acquisition.
 
Safe peak installation guide version 2.1
Safe peak installation guide version 2.1Safe peak installation guide version 2.1
Safe peak installation guide version 2.1
 
Asynchronous architecture (Node.js & Vert.x)
Asynchronous architecture (Node.js & Vert.x)Asynchronous architecture (Node.js & Vert.x)
Asynchronous architecture (Node.js & Vert.x)
 
Apache httpd 2.4 Reverse Proxy: The Hidden Gem
Apache httpd 2.4 Reverse Proxy: The Hidden GemApache httpd 2.4 Reverse Proxy: The Hidden Gem
Apache httpd 2.4 Reverse Proxy: The Hidden Gem
 
Geode is Not a Cache, it's an Analytics Engine
Geode is Not a Cache, it's an Analytics EngineGeode is Not a Cache, it's an Analytics Engine
Geode is Not a Cache, it's an Analytics Engine
 
VUG5: Varnish at Opera Software
VUG5: Varnish at Opera SoftwareVUG5: Varnish at Opera Software
VUG5: Varnish at Opera Software
 

Mehr von Iwana Chan

Varnish Cache inline-C/VMOD guidebook
Varnish Cache inline-C/VMOD guidebookVarnish Cache inline-C/VMOD guidebook
Varnish Cache inline-C/VMOD guidebookIwana Chan
 
社内勉強会資料(Varnish Module)
社内勉強会資料(Varnish Module)社内勉強会資料(Varnish Module)
社内勉強会資料(Varnish Module)Iwana Chan
 
VarnishCache入門Rev2.1
VarnishCache入門Rev2.1VarnishCache入門Rev2.1
VarnishCache入門Rev2.1Iwana Chan
 
tokyo.vcl発表資料(VarnishCache3.0新機能とVUPの仕方)
tokyo.vcl発表資料(VarnishCache3.0新機能とVUPの仕方)tokyo.vcl発表資料(VarnishCache3.0新機能とVUPの仕方)
tokyo.vcl発表資料(VarnishCache3.0新機能とVUPの仕方)Iwana Chan
 
Varnishのログの眺め方
Varnishのログの眺め方Varnishのログの眺め方
Varnishのログの眺め方Iwana Chan
 
できる!Varnish ~もう一歩踏み出すためのTips~
できる!Varnish ~もう一歩踏み出すためのTips~できる!Varnish ~もう一歩踏み出すためのTips~
できる!Varnish ~もう一歩踏み出すためのTips~Iwana Chan
 
画像キャッシュだけじゃないVarnish(qpstudy02 飛び入りLT)
画像キャッシュだけじゃないVarnish(qpstudy02 飛び入りLT)画像キャッシュだけじゃないVarnish(qpstudy02 飛び入りLT)
画像キャッシュだけじゃないVarnish(qpstudy02 飛び入りLT)Iwana Chan
 

Mehr von Iwana Chan (7)

Varnish Cache inline-C/VMOD guidebook
Varnish Cache inline-C/VMOD guidebookVarnish Cache inline-C/VMOD guidebook
Varnish Cache inline-C/VMOD guidebook
 
社内勉強会資料(Varnish Module)
社内勉強会資料(Varnish Module)社内勉強会資料(Varnish Module)
社内勉強会資料(Varnish Module)
 
VarnishCache入門Rev2.1
VarnishCache入門Rev2.1VarnishCache入門Rev2.1
VarnishCache入門Rev2.1
 
tokyo.vcl発表資料(VarnishCache3.0新機能とVUPの仕方)
tokyo.vcl発表資料(VarnishCache3.0新機能とVUPの仕方)tokyo.vcl発表資料(VarnishCache3.0新機能とVUPの仕方)
tokyo.vcl発表資料(VarnishCache3.0新機能とVUPの仕方)
 
Varnishのログの眺め方
Varnishのログの眺め方Varnishのログの眺め方
Varnishのログの眺め方
 
できる!Varnish ~もう一歩踏み出すためのTips~
できる!Varnish ~もう一歩踏み出すためのTips~できる!Varnish ~もう一歩踏み出すためのTips~
できる!Varnish ~もう一歩踏み出すためのTips~
 
画像キャッシュだけじゃないVarnish(qpstudy02 飛び入りLT)
画像キャッシュだけじゃないVarnish(qpstudy02 飛び入りLT)画像キャッシュだけじゃないVarnish(qpstudy02 飛び入りLT)
画像キャッシュだけじゃないVarnish(qpstudy02 飛び入りLT)
 

Lost in Translation:varnishlog, varnishtest(VUG7)

  • 1. Copyright © GREE, Inc. All Rights Reserved.Copyright © GREE, Inc. All Rights Reserved. Lost in Translation: varnishlog, varnishtest ~The Story of a Successful Migration~ GREE, inc. Shohei Tanaka Varnish User Group Meeting 7 Friday, May 31st 2013
  • 2. Copyright © GREE, Inc. All Rights Reserved. Who am I Shohei Tanaka (@xcir) - Call me iwana-chan - GREE, inc. - Joined 2013/01~ - Tokyo, Japan - Activities at varnish project - VMOD author - ldap, redirect, parsereq, awsrest and more.. - Wrote Japanese Varnish guidebook - Other - blog http://blog.xcir.net/ - github http://github.com/xcir/
  • 3. Copyright © GREE, Inc. All Rights Reserved. Migration from legacy system Finished without any downtime - Platform downtime was not an option - Domain / backend has more than a hundred columns - Very high - Traffic - Connection/sec - Request/sec - Many target device types - PC - Smartphone - Mobile phone (No support for keep-alive)
  • 4. Copyright © GREE, Inc. All Rights Reserved. New system Server layout - 3 layer model - Use Hash director - Objects won't be duplicated across L2 pool - ImageOperation - Apache + Varnish - Create thumbs - mod_small_light - Generate barcode(QR) - GREE original
  • 5. Copyright © GREE, Inc. All Rights Reserved. New system VCL layout - Common settings - Same for all server roles - Security, ACL, Normalize.... - Individual server role settings - Backend, Rewrite... - Divide action by - Type (categorized domain) - Domain (can't categorize)
  • 6. Copyright © GREE, Inc. All Rights Reserved. Why Varnish? GREE had never used it - VCL - Very powerful DSL - Fits into existing system - Healthcheck - Varnishtest - Can define the behavior of the server, client, varnish. - Useful tools - varnishncsa and varnishlog are very useful - libvarnishapi can connect to VSL easily - And I love Varnish ;-)
  • 7. Copyright © GREE, Inc. All Rights Reserved. Testing, Testing, Testing! We used varnishtest - Different package for common and server roles - Unit tests for common settings - Integration tests for common + server role
  • 8. Copyright © GREE, Inc. All Rights Reserved. varnishtest(failed log) I love it, but it's difficult to read
  • 9. Copyright © GREE, Inc. All Rights Reserved. varnishtest(failed log) I love it, but it's difficult to read
  • 10. Copyright © GREE, Inc. All Rights Reserved. vtctrans.py Human readable ;) - Sort by - Event - Error output - Header and expected result - Macro define https://github.com/xcir/vtctrans
  • 11. Copyright © GREE, Inc. All Rights Reserved. Screenshot Event varnishtest vtctrans
  • 12. Copyright © GREE, Inc. All Rights Reserved. Screenshot Event varnishtest vtctrans
  • 13. Copyright © GREE, Inc. All Rights Reserved. Screenshot Macro list varnishtest vtctrans
  • 14. Copyright © GREE, Inc. All Rights Reserved. Screenshot Macro list varnishtest vtctrans
  • 15. Copyright © GREE, Inc. All Rights Reserved. Screenshot Header and expected result vtctrans varnishtest
  • 16. Copyright © GREE, Inc. All Rights Reserved. Screenshot Header and expected result vtctrans varnishtest
  • 17. Copyright © GREE, Inc. All Rights Reserved. Performance tuning Measure, don't guess - Nevertheless, capacity planning is important :) - runtime parameters - server specs, placement - fault tolerance (keep service up even when a rack fails) - Measure with production servers, it's the most important thing - Useful commands - varnishncsa -m "txstatus:^[45]" - varnishstat - varnishhist -m "rxheader:Host: foo" - varnishlog -m "rxurl:/foo/bar" - Used varnishncsa and varnishlog alot
  • 18. Copyright © GREE, Inc. All Rights Reserved. varnishlog ugly
  • 19. Copyright © GREE, Inc. All Rights Reserved. vsltrans.py(old:vltrans.php) beautiful! - Sort by - Error output - VCL action - variable - hash and vary - can use multiple -m option https://github.com/xcir/vsltrans
  • 20. Copyright © GREE, Inc. All Rights Reserved. Screenshot General, Error, Hash, Vary info vsltrans and more... varnishlog
  • 21. Copyright © GREE, Inc. All Rights Reserved. Screenshot General, Error, Hash, Vary info vsltrans and more... varnishlog
  • 22. Copyright © GREE, Inc. All Rights Reserved. Screenshot Action vsltrans varnishlog
  • 23. Copyright © GREE, Inc. All Rights Reserved. Screenshot Action vsltrans varnishlog
  • 24. Copyright © GREE, Inc. All Rights Reserved. Screenshot Variable vsltrans varnishlog
  • 25. Copyright © GREE, Inc. All Rights Reserved. Screenshot Variable vsltrans varnishlog
  • 26. Copyright © GREE, Inc. All Rights Reserved. More measurements - By different host - Cache hit rate - Transfer size per sec - Request per sec - By directory (specify depth) - Cache hit rate - Transfer size per sec - Request per sec - And more...
  • 27. Copyright © GREE, Inc. All Rights Reserved. Why do we need a detailed measurements? - Hit rate is summarized by default - Different costs for different objects - Dynamic object: high cost - Static object: low cost - It's necessary to separate results by object cost - Need to consider system cost instead of just Varnish hit rate - However you cannot do this with just the default commands That's where libvarnishapi comes in
  • 28. Copyright © GREE, Inc. All Rights Reserved. libvarnishapi.so - VSL access is easy with libvarnishapi - uses varnishlog, varnishncsa - Used Python ctypes and it proved to be very simple to use - Sample code https://github.com/xcir/python-varnishapi
  • 29. Copyright © GREE, Inc. All Rights Reserved. python-varnishapi sample - VSL data output sample - Made it slightly more readable ;)
  • 30. Copyright © GREE, Inc. All Rights Reserved. python-varnishapi sample
  • 31. Copyright © GREE, Inc. All Rights Reserved. python-varnishapi sample
  • 32. Copyright © GREE, Inc. All Rights Reserved. libvarnishapi: very easy to use Hack on with libvarnishapi and Varnish! Better than making a measuring tool from scratch
  • 33. Copyright © GREE, Inc. All Rights Reserved. Thank you for your attention! Any Questions? @xcir http://blog.xcir.net/ https://github.com/xcir/vtctrans https://github.com/xcir/vsltrans https://github.com/xcir/python-varnishapi