SlideShare a Scribd company logo
1 of 29
Download to read offline
Going to production on
a Raspberry Pi with
varnish tags
Who am I?
Jérémy DERUSSÉ
Web Technical Leader
AptusHealth
@jderusse
How to get fast responses
from a Symfony application?
you can't
How to get fast responses
from a Symfony application?your backend
you can't
Solution
using http shared cache
describe in RFC-2616 RFC-7234
Integration in Symfony
use SensioBundleFrameworkExtraBundleConfigurationCache;
/**
* @Cache(smaxage="3600")
*/
public function indexAction()
{
// ...
}
Advanced usage with FriendsOfSymfony/FOSHttpCacheBundle
Issue #1
Unsharable resources
private resources (ie. invoice, shopping cart, ...)
per role representations
Solution
vary cache on user/role/other
see SfLive 2015 Jérôme Vieilledent & David Buchmann
Repousser les limites : HTTP cache et utilisateurs connectés
Issue #2
Cache invalidation
“ There are only two hard things in Computer Science: cache
invalidation and naming things.
Phil Karlton
Cache models
Validation model
etag
last-modified
drawbacks
application is booted
hard to implement
Expiration model
expires
cache-control
drawback
no control on invalidation
cache model
In a real world
Backend can't validate every cache HIT
Life time is not predictable
BUT
Varnish can be requested to partially invalidate responses
Backend knows when resources change
Responses are build on top of resources
curl -I "http://varnish.myapp.com/c"
curl -I "http://varnish.myapp.com/b"
curl -I "http://varnish.myapp.com/a"
HTTP/1.1 200 OK
Cache-Control: public, s-maxage=3600
X-Cache-Tags: Foo,Bar
HTTP/1.1 200 OK
Cache-Control: public, s-maxage=3600
X-Cache-Tags: Foo
Varnish tags
curl 
-X "BAN" 
-H "X-Cache-Tags: Foo" 
"http://varnish.myapp.com"
HTTP/1.1 200 OK
Cache-Control: public, s-maxage=3600
X-Cache-Tags: Bar,Qux
Varnish tags
curl "http://varnish.myapp.com/posts/42"
HTTP/1.1 200 OK
Cache-Control: public, s-maxage=86400
X-Cache-Tags: Post:42,Author:12,Comment:314,Comment:1337
{
"id": 42,
"title": "My blog post.",
"body": "Lorem Ipsum.",
"author": {
"id": 12,
"username": "jderusse"
},
"comments": [
{
"id": 314,
"message": "Wow such post"
},
{
"id": 1337,
"message": "much performance"
}
]
}
Automate Tagging
Tagging Response
1. Collect displayed resources
2. Generate resource identifier
3. Tag response
Automate Tagging
Tagging Response - 1. Collect displayed resources
namespace AppEventListener;
use JMSSerializerEventDispatcherEvents;
use JMSSerializerEventDispatcherEventSubscriberInterface;
use JMSSerializerEventDispatcherObjectEvent;
class SerializationTagListener implements EventSubscriberInterface
{
public function onPostSerialize(ObjectEvent $event)
{
$resource = $event->getObject();
// TODO
}
public static function getSubscribedEvents()
{
return [
[
'event' => Events::POST_SERIALIZE,
'format' => 'json',
'method' => 'onPostSerialize',
],
];
}
}
Automate Tagging
Tagging Response - 2. Generate resource identifier
namespace AppEventListener;
use AppTagTagExtractorInterface;
use FOSHttpCacheBundleHandlerTagHandler;
use JMSSerializerEventDispatcherEventSubscriberInterface;
use JMSSerializerEventDispatcherObjectEvent;
class SerializationTagListener implements EventSubscriberInterface
{
private $tagExtractor;
public function __construct(TagExtractorInterface $tagExtractor)
{
$this->tagExtractor = $tagExtractor;
}
public function onPostSerialize(ObjectEvent $event): void
{
//...
$tags = $this->tagExtractor->extract($event->getObject());
}
//...
}
Automate Tagging
Tagging Response - 3. Tag response
namespace AppEventListener;
use AppTagTagExtractorInterface;
use FOSHttpCacheBundleHandlerTagHandler;
use JMSSerializerEventDispatcherEventSubscriberInterface;
use JMSSerializerEventDispatcherObjectEvent;
class SerializationTagListener implements EventSubscriberInterface
{
private $tagExtractor;
private $tagHandler;
public function __construct(TagExtractorInterface $tagExtractor, TagHandler $tagHandler)
{
$this->tagExtractor = $tagExtractor;
$this->tagHandler = $tagHandler;
}
public function onPostSerialize(ObjectEvent $event): void
{
$tags = $this->tagExtractor->extract($event->getObject());
$this->tagHandler->addTags($tags);
}
//...
}
Automate Tagging
Tagging Response
1. Collect displayed resources
2. Generate resource identifier
3. Tag response
Invalidate cache
1. Listen changes
2. Generate resource identifier
3. Call varnish
Automate Tagging
Invalidate Cache - 1. Listen changes
namespace AppEventListener;
use DoctrineCommonEventSubscriber;
use DoctrineORMEventOnFlushEventArgs;
use DoctrineORMEvents;
class DoctrineInvalidationTagListener implements EventSubscriber
{
public function getSubscribedEvents()
{
return [Events::onFlush];
}
public function onFlush(OnFlushEventArgs $eventArgs)
{
$uow = $eventArgs->getEntityManager()->getUnitOfWork();
foreach ($uow->getScheduledEntityUpdates() as $resource) {
// TODO
}
foreach ($uow->getScheduledEntityDeletions() as $resource) {
// TODO
}
}
}
Automate Tagging
Invalidate Cache - 2. Generate resource identifier
namespace AppEventListener;
use AppTagTagExtractorInterface;
use DoctrineCommonEventSubscriber;
class DoctrineInvalidationTagListener implements EventSubscriber
{
private $tagExtractor;
public function __construct(TagExtractorInterface $tagExtractor)
{
$this->tagExtractor = $tagExtractor;
}
public function onFlush(OnFlushEventArgs $eventArgs)
{
$uow = $eventArgs->getEntityManager()->getUnitOfWork();
$tags = [];
foreach ($uow->getScheduledEntityUpdates() as $resource) {
$tags = array_merge($tags, $this->tagExtractor->extract($resource));
}
foreach ($uow->getScheduledEntityDeletions() as $resource) {
$tags = array_merge($tags, $this->tagExtractor->extract($resource));
}
// TODO
}
}
Automate Tagging
Invalidate Cache - 3. Call varnish
namespace AppEventListener;
use AppTagTagExtractorInterface;
use DoctrineCommonEventSubscriber;
use FOSHttpCacheHandlerTagHandler;
class DoctrineInvalidationTagListener implements EventSubscriber
{
private $tagExtractor;
public function __construct(TagExtractorInterface $tagExtractor, TagHandler $tagHandler)
{
$this->tagExtractor = $tagExtractor;
$this->tagHandler = $tagHandler;
}
public function onFlush(OnFlushEventArgs $eventArgs)
{
// ...
$this->tagHandler->invalidateTags($tags);
}
}
Automate Tagging
Tagging Response
1. Collect displayed resources
2. Generate resource identifier
3. Tag response
Invalidate cache
1. Listen changes
2. Generate resource identifier
3. Call varnish
Enjoy
Silver bullet?
Works well when
HIT >> MISS
Read >> Write
Application knows resources used to build
response
Drawback
Operations are not Atomic
Backend handles writes
Backend knows infrastructure
It slows writes
Demo
Software
- env=dev
- fetch=lazy
symfony/symfony
doctrine/doctrine-bundle
friendsofsymfony/rest-bundle
jms/serializer-bundle
friendsofsymfony/http-cache-bundle
marmelab/admin-on-rest
Demo
Hardware
Raspberry Pi Orange Pi
docker
MySQL
NGINX
PHP7-FPM
Varnish
$9.59
Demo
ab -n 8000 -c 26 192.168.1.17:81/comments/1
This is ApacheBench, Version 2.3 <$Revision: 1757674 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net
Licensed to The Apache Software Foundation, http://www.apache.org/
Server Software: nginx/1.10.3
Server Hostname: 192.168.1.16
Server Port: 80
Document Path: /comments/1
Document Length: 576 bytes
Concurrency Level: 26
Time taken for tests: 26.912 seconds
Complete requests: 200
Failed requests: 0
Total transferred: 193400 bytes
HTML transferred: 115200 bytes
Requests per second: 7.43 [#/sec] (mean)
Time per request: 3498.553 [ms] (mean)
Time per request: 134.560 [ms] (mean, across all concurrent
Transfer rate: 7.02 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 1 2 1.4 1 6
Processing: 546 3342 1156.7 3020 7204
Waiting: 546 3342 1156.7 3020 7204
Total: 550 3344 1156.5 3021 7205
in numbers
ab -n 8000 -c 26 192.168.1.17/comments/1
This is ApacheBench, Version 2.3 <$Revision: 1757674 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net
Licensed to The Apache Software Foundation, http://www.apache.org/
Server Software: nginx/1.10.3
Server Hostname: 192.168.1.17
Server Port: 80
Document Path: /comments/1
Document Length: 576 bytes
Concurrency Level: 26
Time taken for tests: 2.340 seconds
Complete requests: 8000
Failed requests: 0
Total transferred: 8948504 bytes
HTML transferred: 4608000 bytes
Requests per second: 3418.52 [#/sec] (mean)
Time per request: 7.606 [ms] (mean)
Time per request: 0.293 [ms] (mean, across all concurrent
Transfer rate: 3734.21 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 2 0.8 2 7
Processing: 2 5 3.3 5 55
Waiting: 2 5 3.3 4 55
Total: 2 8 3.3 7 56
app varnish
Thank You
Questions?
Credits
http://linuxgizmos.com/10-dollar-orange-pi-one-pits-quad-core-cortex-a7-against-pi-zero/
http://toutsurlesbisounours.centerblog.net/rub-bisounours-3eme-generation-.html
https://de.wikipedia.org/wiki/Carambar
https://rcgo.com.br/recursos.html

More Related Content

What's hot

Laravel 5 Annotations: RESTful API routing
Laravel 5 Annotations: RESTful API routingLaravel 5 Annotations: RESTful API routing
Laravel 5 Annotations: RESTful API routingChristopher Pecoraro
 
RESTful API development in Laravel 4 - Christopher Pecoraro
RESTful API development in Laravel 4 - Christopher PecoraroRESTful API development in Laravel 4 - Christopher Pecoraro
RESTful API development in Laravel 4 - Christopher PecoraroChristopher Pecoraro
 
High Quality Symfony Bundles tutorial - Dutch PHP Conference 2014
High Quality Symfony Bundles tutorial - Dutch PHP Conference 2014High Quality Symfony Bundles tutorial - Dutch PHP Conference 2014
High Quality Symfony Bundles tutorial - Dutch PHP Conference 2014Matthias Noback
 
Webpack Encore Symfony Live 2017 San Francisco
Webpack Encore Symfony Live 2017 San FranciscoWebpack Encore Symfony Live 2017 San Francisco
Webpack Encore Symfony Live 2017 San FranciscoRyan Weaver
 
170517 damien gérard framework facebook
170517 damien gérard   framework facebook170517 damien gérard   framework facebook
170517 damien gérard framework facebookGeeks Anonymes
 
Finally, Professional Frontend Dev with ReactJS, WebPack & Symfony (Symfony C...
Finally, Professional Frontend Dev with ReactJS, WebPack & Symfony (Symfony C...Finally, Professional Frontend Dev with ReactJS, WebPack & Symfony (Symfony C...
Finally, Professional Frontend Dev with ReactJS, WebPack & Symfony (Symfony C...Ryan Weaver
 
Symfony tips and tricks
Symfony tips and tricksSymfony tips and tricks
Symfony tips and tricksJavier Eguiluz
 
Web service with Laravel
Web service with LaravelWeb service with Laravel
Web service with LaravelAbuzer Firdousi
 
Playing with parse.com
Playing with parse.comPlaying with parse.com
Playing with parse.comJUG Genova
 
Flask RESTful Flask HTTPAuth
Flask RESTful Flask HTTPAuthFlask RESTful Flask HTTPAuth
Flask RESTful Flask HTTPAuthEueung Mulyana
 
Dessi docker kubernetes paas cloud
Dessi docker kubernetes paas cloudDessi docker kubernetes paas cloud
Dessi docker kubernetes paas cloudMassimiliano Dessì
 
Datagrids with Symfony 2, Backbone and Backgrid
Datagrids with Symfony 2, Backbone and BackgridDatagrids with Symfony 2, Backbone and Backgrid
Datagrids with Symfony 2, Backbone and Backgrideugenio pombi
 
Building Web Services with Zend Framework (PHP Benelux meeting 20100713 Vliss...
Building Web Services with Zend Framework (PHP Benelux meeting 20100713 Vliss...Building Web Services with Zend Framework (PHP Benelux meeting 20100713 Vliss...
Building Web Services with Zend Framework (PHP Benelux meeting 20100713 Vliss...King Foo
 
Dockerize it! @ Codemotion 2016 in Rome
Dockerize it! @ Codemotion 2016 in RomeDockerize it! @ Codemotion 2016 in Rome
Dockerize it! @ Codemotion 2016 in RomeAlessandro Nadalin
 
Rails vs Web2py
Rails vs Web2pyRails vs Web2py
Rails vs Web2pyjonromero
 
Composable and streamable Play apps
Composable and streamable Play appsComposable and streamable Play apps
Composable and streamable Play appsYevgeniy Brikman
 

What's hot (20)

Laravel 5 Annotations: RESTful API routing
Laravel 5 Annotations: RESTful API routingLaravel 5 Annotations: RESTful API routing
Laravel 5 Annotations: RESTful API routing
 
RESTful API development in Laravel 4 - Christopher Pecoraro
RESTful API development in Laravel 4 - Christopher PecoraroRESTful API development in Laravel 4 - Christopher Pecoraro
RESTful API development in Laravel 4 - Christopher Pecoraro
 
High Quality Symfony Bundles tutorial - Dutch PHP Conference 2014
High Quality Symfony Bundles tutorial - Dutch PHP Conference 2014High Quality Symfony Bundles tutorial - Dutch PHP Conference 2014
High Quality Symfony Bundles tutorial - Dutch PHP Conference 2014
 
Webpack Encore Symfony Live 2017 San Francisco
Webpack Encore Symfony Live 2017 San FranciscoWebpack Encore Symfony Live 2017 San Francisco
Webpack Encore Symfony Live 2017 San Francisco
 
170517 damien gérard framework facebook
170517 damien gérard   framework facebook170517 damien gérard   framework facebook
170517 damien gérard framework facebook
 
Finally, Professional Frontend Dev with ReactJS, WebPack & Symfony (Symfony C...
Finally, Professional Frontend Dev with ReactJS, WebPack & Symfony (Symfony C...Finally, Professional Frontend Dev with ReactJS, WebPack & Symfony (Symfony C...
Finally, Professional Frontend Dev with ReactJS, WebPack & Symfony (Symfony C...
 
Symfony tips and tricks
Symfony tips and tricksSymfony tips and tricks
Symfony tips and tricks
 
Web service with Laravel
Web service with LaravelWeb service with Laravel
Web service with Laravel
 
Javascript laravel's friend
Javascript laravel's friendJavascript laravel's friend
Javascript laravel's friend
 
Playing with parse.com
Playing with parse.comPlaying with parse.com
Playing with parse.com
 
Flask RESTful Flask HTTPAuth
Flask RESTful Flask HTTPAuthFlask RESTful Flask HTTPAuth
Flask RESTful Flask HTTPAuth
 
Dessi docker kubernetes paas cloud
Dessi docker kubernetes paas cloudDessi docker kubernetes paas cloud
Dessi docker kubernetes paas cloud
 
Symfony 2
Symfony 2Symfony 2
Symfony 2
 
Datagrids with Symfony 2, Backbone and Backgrid
Datagrids with Symfony 2, Backbone and BackgridDatagrids with Symfony 2, Backbone and Backgrid
Datagrids with Symfony 2, Backbone and Backgrid
 
Building Web Services with Zend Framework (PHP Benelux meeting 20100713 Vliss...
Building Web Services with Zend Framework (PHP Benelux meeting 20100713 Vliss...Building Web Services with Zend Framework (PHP Benelux meeting 20100713 Vliss...
Building Web Services with Zend Framework (PHP Benelux meeting 20100713 Vliss...
 
Dockerize it! @ Codemotion 2016 in Rome
Dockerize it! @ Codemotion 2016 in RomeDockerize it! @ Codemotion 2016 in Rome
Dockerize it! @ Codemotion 2016 in Rome
 
Rails vs Web2py
Rails vs Web2pyRails vs Web2py
Rails vs Web2py
 
Flask Basics
Flask BasicsFlask Basics
Flask Basics
 
Composable and streamable Play apps
Composable and streamable Play appsComposable and streamable Play apps
Composable and streamable Play apps
 
Beyond Phoenix
Beyond PhoenixBeyond Phoenix
Beyond Phoenix
 

Viewers also liked

How to Become a Thought Leader in Your Niche
How to Become a Thought Leader in Your NicheHow to Become a Thought Leader in Your Niche
How to Become a Thought Leader in Your NicheLeslie Samuel
 
Introduction to CQRS and Event Sourcing
Introduction to CQRS and Event SourcingIntroduction to CQRS and Event Sourcing
Introduction to CQRS and Event SourcingSamuel ROZE
 
conservation and rewarding biodiversity conservation Trondheim 05-10-gupta-...
conservation and rewarding biodiversity conservation Trondheim   05-10-gupta-...conservation and rewarding biodiversity conservation Trondheim   05-10-gupta-...
conservation and rewarding biodiversity conservation Trondheim 05-10-gupta-...Dr Anil Gupta
 
How to Create 1000 Sony
How to Create 1000 SonyHow to Create 1000 Sony
How to Create 1000 SonyHAX
 
A Publisher's Survival Guide for the Platform Era
A Publisher's Survival Guide for the Platform EraA Publisher's Survival Guide for the Platform Era
A Publisher's Survival Guide for the Platform EraBloomberg Media
 
FrenchWeb 500, le classement des entreprises de la tech française
FrenchWeb 500, le classement des entreprises de la tech françaiseFrenchWeb 500, le classement des entreprises de la tech française
FrenchWeb 500, le classement des entreprises de la tech françaiseFrenchWeb.fr
 
Construire Des Applications Cloud Natives - SymfonyLive Paris 2016
Construire Des Applications Cloud Natives - SymfonyLive Paris 2016Construire Des Applications Cloud Natives - SymfonyLive Paris 2016
Construire Des Applications Cloud Natives - SymfonyLive Paris 2016Ori Pekelman
 
Fists with Your Toes - Learning to relax as a UX / BA crossbreed
Fists with Your Toes - Learning to relax as a UX / BA crossbreedFists with Your Toes - Learning to relax as a UX / BA crossbreed
Fists with Your Toes - Learning to relax as a UX / BA crossbreedLeo Barnes
 
Bucay, jorge el camino de la autodependencia
Bucay, jorge   el camino de la autodependenciaBucay, jorge   el camino de la autodependencia
Bucay, jorge el camino de la autodependenciasilvianoramirezgomez
 
Entrevista, grupo focal y diario de campo NRC30018
Entrevista, grupo focal y diario de campo NRC30018Entrevista, grupo focal y diario de campo NRC30018
Entrevista, grupo focal y diario de campo NRC30018John Sevastien
 
An introduction to english literature i
An introduction to english literature iAn introduction to english literature i
An introduction to english literature ipuchmuller
 
Surviving in an Async-First Development World
Surviving in an Async-First Development WorldSurviving in an Async-First Development World
Surviving in an Async-First Development WorldMirco Vanini
 
The Mysteries Of Harris Burdickfv
The Mysteries Of Harris BurdickfvThe Mysteries Of Harris Burdickfv
The Mysteries Of Harris Burdickfvaquaglia
 
Cloud in Action
Cloud in Action Cloud in Action
Cloud in Action Franco Ucci
 
Fitness tips for women
Fitness tips for womenFitness tips for women
Fitness tips for womenMedisys Kart
 

Viewers also liked (17)

How to Become a Thought Leader in Your Niche
How to Become a Thought Leader in Your NicheHow to Become a Thought Leader in Your Niche
How to Become a Thought Leader in Your Niche
 
Introduction to CQRS and Event Sourcing
Introduction to CQRS and Event SourcingIntroduction to CQRS and Event Sourcing
Introduction to CQRS and Event Sourcing
 
conservation and rewarding biodiversity conservation Trondheim 05-10-gupta-...
conservation and rewarding biodiversity conservation Trondheim   05-10-gupta-...conservation and rewarding biodiversity conservation Trondheim   05-10-gupta-...
conservation and rewarding biodiversity conservation Trondheim 05-10-gupta-...
 
How to Create 1000 Sony
How to Create 1000 SonyHow to Create 1000 Sony
How to Create 1000 Sony
 
A Publisher's Survival Guide for the Platform Era
A Publisher's Survival Guide for the Platform EraA Publisher's Survival Guide for the Platform Era
A Publisher's Survival Guide for the Platform Era
 
FrenchWeb 500, le classement des entreprises de la tech française
FrenchWeb 500, le classement des entreprises de la tech françaiseFrenchWeb 500, le classement des entreprises de la tech française
FrenchWeb 500, le classement des entreprises de la tech française
 
Construire Des Applications Cloud Natives - SymfonyLive Paris 2016
Construire Des Applications Cloud Natives - SymfonyLive Paris 2016Construire Des Applications Cloud Natives - SymfonyLive Paris 2016
Construire Des Applications Cloud Natives - SymfonyLive Paris 2016
 
Portadas nacionales 30 marzo-17.pdf
Portadas nacionales 30 marzo-17.pdfPortadas nacionales 30 marzo-17.pdf
Portadas nacionales 30 marzo-17.pdf
 
Fists with Your Toes - Learning to relax as a UX / BA crossbreed
Fists with Your Toes - Learning to relax as a UX / BA crossbreedFists with Your Toes - Learning to relax as a UX / BA crossbreed
Fists with Your Toes - Learning to relax as a UX / BA crossbreed
 
Bucay, jorge el camino de la autodependencia
Bucay, jorge   el camino de la autodependenciaBucay, jorge   el camino de la autodependencia
Bucay, jorge el camino de la autodependencia
 
HdE - Spegulo
HdE - SpeguloHdE - Spegulo
HdE - Spegulo
 
Entrevista, grupo focal y diario de campo NRC30018
Entrevista, grupo focal y diario de campo NRC30018Entrevista, grupo focal y diario de campo NRC30018
Entrevista, grupo focal y diario de campo NRC30018
 
An introduction to english literature i
An introduction to english literature iAn introduction to english literature i
An introduction to english literature i
 
Surviving in an Async-First Development World
Surviving in an Async-First Development WorldSurviving in an Async-First Development World
Surviving in an Async-First Development World
 
The Mysteries Of Harris Burdickfv
The Mysteries Of Harris BurdickfvThe Mysteries Of Harris Burdickfv
The Mysteries Of Harris Burdickfv
 
Cloud in Action
Cloud in Action Cloud in Action
Cloud in Action
 
Fitness tips for women
Fitness tips for womenFitness tips for women
Fitness tips for women
 

Similar to Grâce aux tags Varnish, j'ai switché ma prod sur Raspberry Pi

Heavy Web Optimization: Backend
Heavy Web Optimization: BackendHeavy Web Optimization: Backend
Heavy Web Optimization: BackendVõ Duy Tuấn
 
Meetup Performance
Meetup PerformanceMeetup Performance
Meetup PerformanceGreg Whalin
 
Exploring Async PHP (SF Live Berlin 2019)
Exploring Async PHP (SF Live Berlin 2019)Exploring Async PHP (SF Live Berlin 2019)
Exploring Async PHP (SF Live Berlin 2019)dantleech
 
Porting Rails Apps to High Availability Systems
Porting Rails Apps to High Availability SystemsPorting Rails Apps to High Availability Systems
Porting Rails Apps to High Availability SystemsMarcelo Pinheiro
 
Lean Php Presentation
Lean Php PresentationLean Php Presentation
Lean Php PresentationAlan Pinstein
 
Harmonious Development: Via Vagrant and Puppet
Harmonious Development: Via Vagrant and PuppetHarmonious Development: Via Vagrant and Puppet
Harmonious Development: Via Vagrant and PuppetAchieve Internet
 
Rapid java backend and api development for mobile devices
Rapid java backend and api development for mobile devicesRapid java backend and api development for mobile devices
Rapid java backend and api development for mobile devicesciklum_ods
 
Speed up your developments with Symfony2
Speed up your developments with Symfony2Speed up your developments with Symfony2
Speed up your developments with Symfony2Hugo Hamon
 
Build powerfull and smart web applications with Symfony2
Build powerfull and smart web applications with Symfony2Build powerfull and smart web applications with Symfony2
Build powerfull and smart web applications with Symfony2Hugo Hamon
 
Introduction to PowerShell
Introduction to PowerShellIntroduction to PowerShell
Introduction to PowerShellBoulos Dib
 
2019 11-bgphp
2019 11-bgphp2019 11-bgphp
2019 11-bgphpdantleech
 
How to Design a Great API (using flask) [ploneconf2017]
How to Design a Great API (using flask) [ploneconf2017]How to Design a Great API (using flask) [ploneconf2017]
How to Design a Great API (using flask) [ploneconf2017]Devon Bernard
 
Symfony finally swiped right on envvars
Symfony finally swiped right on envvarsSymfony finally swiped right on envvars
Symfony finally swiped right on envvarsSam Marley-Jarrett
 
Art of Web Backdoor - Pichaya Morimoto
Art of Web Backdoor - Pichaya MorimotoArt of Web Backdoor - Pichaya Morimoto
Art of Web Backdoor - Pichaya MorimotoPichaya Morimoto
 
Simplify your professional web development with symfony
Simplify your professional web development with symfonySimplify your professional web development with symfony
Simplify your professional web development with symfonyFrancois Zaninotto
 
Vagrant for real codemotion (moar tips! ;-))
Vagrant for real codemotion (moar tips! ;-))Vagrant for real codemotion (moar tips! ;-))
Vagrant for real codemotion (moar tips! ;-))Michele Orselli
 
Release with confidence
Release with confidenceRelease with confidence
Release with confidenceJohn Congdon
 
SymfonyCon Berlin 2016 - Symfony Plugin for PhpStorm - 3 years later
SymfonyCon Berlin 2016 - Symfony Plugin for PhpStorm - 3 years laterSymfonyCon Berlin 2016 - Symfony Plugin for PhpStorm - 3 years later
SymfonyCon Berlin 2016 - Symfony Plugin for PhpStorm - 3 years laterHaehnchen
 

Similar to Grâce aux tags Varnish, j'ai switché ma prod sur Raspberry Pi (20)

Heavy Web Optimization: Backend
Heavy Web Optimization: BackendHeavy Web Optimization: Backend
Heavy Web Optimization: Backend
 
Meetup Performance
Meetup PerformanceMeetup Performance
Meetup Performance
 
Meetup Performance
Meetup PerformanceMeetup Performance
Meetup Performance
 
Exploring Async PHP (SF Live Berlin 2019)
Exploring Async PHP (SF Live Berlin 2019)Exploring Async PHP (SF Live Berlin 2019)
Exploring Async PHP (SF Live Berlin 2019)
 
Porting Rails Apps to High Availability Systems
Porting Rails Apps to High Availability SystemsPorting Rails Apps to High Availability Systems
Porting Rails Apps to High Availability Systems
 
Lean Php Presentation
Lean Php PresentationLean Php Presentation
Lean Php Presentation
 
Harmonious Development: Via Vagrant and Puppet
Harmonious Development: Via Vagrant and PuppetHarmonious Development: Via Vagrant and Puppet
Harmonious Development: Via Vagrant and Puppet
 
Rapid java backend and api development for mobile devices
Rapid java backend and api development for mobile devicesRapid java backend and api development for mobile devices
Rapid java backend and api development for mobile devices
 
Speed up your developments with Symfony2
Speed up your developments with Symfony2Speed up your developments with Symfony2
Speed up your developments with Symfony2
 
Build powerfull and smart web applications with Symfony2
Build powerfull and smart web applications with Symfony2Build powerfull and smart web applications with Symfony2
Build powerfull and smart web applications with Symfony2
 
Introduction to PowerShell
Introduction to PowerShellIntroduction to PowerShell
Introduction to PowerShell
 
Symfony2 revealed
Symfony2 revealedSymfony2 revealed
Symfony2 revealed
 
2019 11-bgphp
2019 11-bgphp2019 11-bgphp
2019 11-bgphp
 
How to Design a Great API (using flask) [ploneconf2017]
How to Design a Great API (using flask) [ploneconf2017]How to Design a Great API (using flask) [ploneconf2017]
How to Design a Great API (using flask) [ploneconf2017]
 
Symfony finally swiped right on envvars
Symfony finally swiped right on envvarsSymfony finally swiped right on envvars
Symfony finally swiped right on envvars
 
Art of Web Backdoor - Pichaya Morimoto
Art of Web Backdoor - Pichaya MorimotoArt of Web Backdoor - Pichaya Morimoto
Art of Web Backdoor - Pichaya Morimoto
 
Simplify your professional web development with symfony
Simplify your professional web development with symfonySimplify your professional web development with symfony
Simplify your professional web development with symfony
 
Vagrant for real codemotion (moar tips! ;-))
Vagrant for real codemotion (moar tips! ;-))Vagrant for real codemotion (moar tips! ;-))
Vagrant for real codemotion (moar tips! ;-))
 
Release with confidence
Release with confidenceRelease with confidence
Release with confidence
 
SymfonyCon Berlin 2016 - Symfony Plugin for PhpStorm - 3 years later
SymfonyCon Berlin 2016 - Symfony Plugin for PhpStorm - 3 years laterSymfonyCon Berlin 2016 - Symfony Plugin for PhpStorm - 3 years later
SymfonyCon Berlin 2016 - Symfony Plugin for PhpStorm - 3 years later
 

Recently uploaded

Anypoint Code Builder - Munich MuleSoft Meetup - 16th May 2024
Anypoint Code Builder - Munich MuleSoft Meetup - 16th May 2024Anypoint Code Builder - Munich MuleSoft Meetup - 16th May 2024
Anypoint Code Builder - Munich MuleSoft Meetup - 16th May 2024MulesoftMunichMeetup
 
OpenChain Webinar: AboutCode and Beyond - End-to-End SCA
OpenChain Webinar: AboutCode and Beyond - End-to-End SCAOpenChain Webinar: AboutCode and Beyond - End-to-End SCA
OpenChain Webinar: AboutCode and Beyond - End-to-End SCAShane Coughlan
 
Test Automation Design Patterns_ A Comprehensive Guide.pdf
Test Automation Design Patterns_ A Comprehensive Guide.pdfTest Automation Design Patterns_ A Comprehensive Guide.pdf
Test Automation Design Patterns_ A Comprehensive Guide.pdfkalichargn70th171
 
Abortion Pills For Sale WhatsApp[[+27737758557]] In Birch Acres, Abortion Pil...
Abortion Pills For Sale WhatsApp[[+27737758557]] In Birch Acres, Abortion Pil...Abortion Pills For Sale WhatsApp[[+27737758557]] In Birch Acres, Abortion Pil...
Abortion Pills For Sale WhatsApp[[+27737758557]] In Birch Acres, Abortion Pil...drm1699
 
Wired_2.0_CREATE YOUR ULTIMATE LEARNING ENVIRONMENT_JCON_16052024
Wired_2.0_CREATE YOUR ULTIMATE LEARNING ENVIRONMENT_JCON_16052024Wired_2.0_CREATE YOUR ULTIMATE LEARNING ENVIRONMENT_JCON_16052024
Wired_2.0_CREATE YOUR ULTIMATE LEARNING ENVIRONMENT_JCON_16052024SimonedeGijt
 
Workshop - Architecting Innovative Graph Applications- GraphSummit Milan
Workshop -  Architecting Innovative Graph Applications- GraphSummit MilanWorkshop -  Architecting Innovative Graph Applications- GraphSummit Milan
Workshop - Architecting Innovative Graph Applications- GraphSummit MilanNeo4j
 
GraphSummit Milan - Neo4j: The Art of the Possible with Graph
GraphSummit Milan - Neo4j: The Art of the Possible with GraphGraphSummit Milan - Neo4j: The Art of the Possible with Graph
GraphSummit Milan - Neo4j: The Art of the Possible with GraphNeo4j
 
Team Transformation Tactics for Holistic Testing and Quality (NewCrafts Paris...
Team Transformation Tactics for Holistic Testing and Quality (NewCrafts Paris...Team Transformation Tactics for Holistic Testing and Quality (NewCrafts Paris...
Team Transformation Tactics for Holistic Testing and Quality (NewCrafts Paris...Lisi Hocke
 
Effective Strategies for Wix's Scaling challenges - GeeCon
Effective Strategies for Wix's Scaling challenges - GeeConEffective Strategies for Wix's Scaling challenges - GeeCon
Effective Strategies for Wix's Scaling challenges - GeeConNatan Silnitsky
 
UNI DI NAPOLI FEDERICO II - Il ruolo dei grafi nell'AI Conversazionale Ibrida
UNI DI NAPOLI FEDERICO II - Il ruolo dei grafi nell'AI Conversazionale IbridaUNI DI NAPOLI FEDERICO II - Il ruolo dei grafi nell'AI Conversazionale Ibrida
UNI DI NAPOLI FEDERICO II - Il ruolo dei grafi nell'AI Conversazionale IbridaNeo4j
 
Evolving Data Governance for the Real-time Streaming and AI Era
Evolving Data Governance for the Real-time Streaming and AI EraEvolving Data Governance for the Real-time Streaming and AI Era
Evolving Data Governance for the Real-time Streaming and AI Eraconfluent
 
BusinessGPT - Security and Governance for Generative AI
BusinessGPT  - Security and Governance for Generative AIBusinessGPT  - Security and Governance for Generative AI
BusinessGPT - Security and Governance for Generative AIAGATSoftware
 
Community is Just as Important as Code by Andrea Goulet
Community is Just as Important as Code by Andrea GouletCommunity is Just as Important as Code by Andrea Goulet
Community is Just as Important as Code by Andrea GouletAndrea Goulet
 
[GeeCON2024] How I learned to stop worrying and love the dark silicon apocalypse
[GeeCON2024] How I learned to stop worrying and love the dark silicon apocalypse[GeeCON2024] How I learned to stop worrying and love the dark silicon apocalypse
[GeeCON2024] How I learned to stop worrying and love the dark silicon apocalypseTomasz Kowalczewski
 
Modern binary build systems - PyCon 2024
Modern binary build systems - PyCon 2024Modern binary build systems - PyCon 2024
Modern binary build systems - PyCon 2024Henry Schreiner
 
AzureNativeQumulo_HPC_Cloud_Native_Benchmarks.pdf
AzureNativeQumulo_HPC_Cloud_Native_Benchmarks.pdfAzureNativeQumulo_HPC_Cloud_Native_Benchmarks.pdf
AzureNativeQumulo_HPC_Cloud_Native_Benchmarks.pdfryanfarris8
 

Recently uploaded (20)

Anypoint Code Builder - Munich MuleSoft Meetup - 16th May 2024
Anypoint Code Builder - Munich MuleSoft Meetup - 16th May 2024Anypoint Code Builder - Munich MuleSoft Meetup - 16th May 2024
Anypoint Code Builder - Munich MuleSoft Meetup - 16th May 2024
 
OpenChain Webinar: AboutCode and Beyond - End-to-End SCA
OpenChain Webinar: AboutCode and Beyond - End-to-End SCAOpenChain Webinar: AboutCode and Beyond - End-to-End SCA
OpenChain Webinar: AboutCode and Beyond - End-to-End SCA
 
Abortion Clinic In Stanger ](+27832195400*)[ 🏥 Safe Abortion Pills In Stanger...
Abortion Clinic In Stanger ](+27832195400*)[ 🏥 Safe Abortion Pills In Stanger...Abortion Clinic In Stanger ](+27832195400*)[ 🏥 Safe Abortion Pills In Stanger...
Abortion Clinic In Stanger ](+27832195400*)[ 🏥 Safe Abortion Pills In Stanger...
 
Test Automation Design Patterns_ A Comprehensive Guide.pdf
Test Automation Design Patterns_ A Comprehensive Guide.pdfTest Automation Design Patterns_ A Comprehensive Guide.pdf
Test Automation Design Patterns_ A Comprehensive Guide.pdf
 
Abortion Pills For Sale WhatsApp[[+27737758557]] In Birch Acres, Abortion Pil...
Abortion Pills For Sale WhatsApp[[+27737758557]] In Birch Acres, Abortion Pil...Abortion Pills For Sale WhatsApp[[+27737758557]] In Birch Acres, Abortion Pil...
Abortion Pills For Sale WhatsApp[[+27737758557]] In Birch Acres, Abortion Pil...
 
Wired_2.0_CREATE YOUR ULTIMATE LEARNING ENVIRONMENT_JCON_16052024
Wired_2.0_CREATE YOUR ULTIMATE LEARNING ENVIRONMENT_JCON_16052024Wired_2.0_CREATE YOUR ULTIMATE LEARNING ENVIRONMENT_JCON_16052024
Wired_2.0_CREATE YOUR ULTIMATE LEARNING ENVIRONMENT_JCON_16052024
 
Workshop - Architecting Innovative Graph Applications- GraphSummit Milan
Workshop -  Architecting Innovative Graph Applications- GraphSummit MilanWorkshop -  Architecting Innovative Graph Applications- GraphSummit Milan
Workshop - Architecting Innovative Graph Applications- GraphSummit Milan
 
GraphSummit Milan - Neo4j: The Art of the Possible with Graph
GraphSummit Milan - Neo4j: The Art of the Possible with GraphGraphSummit Milan - Neo4j: The Art of the Possible with Graph
GraphSummit Milan - Neo4j: The Art of the Possible with Graph
 
Team Transformation Tactics for Holistic Testing and Quality (NewCrafts Paris...
Team Transformation Tactics for Holistic Testing and Quality (NewCrafts Paris...Team Transformation Tactics for Holistic Testing and Quality (NewCrafts Paris...
Team Transformation Tactics for Holistic Testing and Quality (NewCrafts Paris...
 
Effective Strategies for Wix's Scaling challenges - GeeCon
Effective Strategies for Wix's Scaling challenges - GeeConEffective Strategies for Wix's Scaling challenges - GeeCon
Effective Strategies for Wix's Scaling challenges - GeeCon
 
UNI DI NAPOLI FEDERICO II - Il ruolo dei grafi nell'AI Conversazionale Ibrida
UNI DI NAPOLI FEDERICO II - Il ruolo dei grafi nell'AI Conversazionale IbridaUNI DI NAPOLI FEDERICO II - Il ruolo dei grafi nell'AI Conversazionale Ibrida
UNI DI NAPOLI FEDERICO II - Il ruolo dei grafi nell'AI Conversazionale Ibrida
 
Evolving Data Governance for the Real-time Streaming and AI Era
Evolving Data Governance for the Real-time Streaming and AI EraEvolving Data Governance for the Real-time Streaming and AI Era
Evolving Data Governance for the Real-time Streaming and AI Era
 
BusinessGPT - Security and Governance for Generative AI
BusinessGPT  - Security and Governance for Generative AIBusinessGPT  - Security and Governance for Generative AI
BusinessGPT - Security and Governance for Generative AI
 
Community is Just as Important as Code by Andrea Goulet
Community is Just as Important as Code by Andrea GouletCommunity is Just as Important as Code by Andrea Goulet
Community is Just as Important as Code by Andrea Goulet
 
[GeeCON2024] How I learned to stop worrying and love the dark silicon apocalypse
[GeeCON2024] How I learned to stop worrying and love the dark silicon apocalypse[GeeCON2024] How I learned to stop worrying and love the dark silicon apocalypse
[GeeCON2024] How I learned to stop worrying and love the dark silicon apocalypse
 
Modern binary build systems - PyCon 2024
Modern binary build systems - PyCon 2024Modern binary build systems - PyCon 2024
Modern binary build systems - PyCon 2024
 
AzureNativeQumulo_HPC_Cloud_Native_Benchmarks.pdf
AzureNativeQumulo_HPC_Cloud_Native_Benchmarks.pdfAzureNativeQumulo_HPC_Cloud_Native_Benchmarks.pdf
AzureNativeQumulo_HPC_Cloud_Native_Benchmarks.pdf
 
Abortion Pill Prices Polokwane ](+27832195400*)[ 🏥 Women's Abortion Clinic in...
Abortion Pill Prices Polokwane ](+27832195400*)[ 🏥 Women's Abortion Clinic in...Abortion Pill Prices Polokwane ](+27832195400*)[ 🏥 Women's Abortion Clinic in...
Abortion Pill Prices Polokwane ](+27832195400*)[ 🏥 Women's Abortion Clinic in...
 
Abortion Clinic in Midrand [(+27832195400*)]🏥Safe Abortion Pills In Midrand |...
Abortion Clinic in Midrand [(+27832195400*)]🏥Safe Abortion Pills In Midrand |...Abortion Clinic in Midrand [(+27832195400*)]🏥Safe Abortion Pills In Midrand |...
Abortion Clinic in Midrand [(+27832195400*)]🏥Safe Abortion Pills In Midrand |...
 
Abortion Clinic in Bloemfontein [(+27832195400*)]🏥Safe Abortion Pills In Bloe...
Abortion Clinic in Bloemfontein [(+27832195400*)]🏥Safe Abortion Pills In Bloe...Abortion Clinic in Bloemfontein [(+27832195400*)]🏥Safe Abortion Pills In Bloe...
Abortion Clinic in Bloemfontein [(+27832195400*)]🏥Safe Abortion Pills In Bloe...
 

Grâce aux tags Varnish, j'ai switché ma prod sur Raspberry Pi

  • 1. Going to production on a Raspberry Pi with varnish tags
  • 2. Who am I? Jérémy DERUSSÉ Web Technical Leader AptusHealth @jderusse
  • 3. How to get fast responses from a Symfony application? you can't
  • 4. How to get fast responses from a Symfony application?your backend you can't
  • 5. Solution using http shared cache describe in RFC-2616 RFC-7234
  • 6. Integration in Symfony use SensioBundleFrameworkExtraBundleConfigurationCache; /** * @Cache(smaxage="3600") */ public function indexAction() { // ... } Advanced usage with FriendsOfSymfony/FOSHttpCacheBundle
  • 7. Issue #1 Unsharable resources private resources (ie. invoice, shopping cart, ...) per role representations Solution vary cache on user/role/other see SfLive 2015 Jérôme Vieilledent & David Buchmann Repousser les limites : HTTP cache et utilisateurs connectés
  • 8. Issue #2 Cache invalidation “ There are only two hard things in Computer Science: cache invalidation and naming things. Phil Karlton
  • 9. Cache models Validation model etag last-modified drawbacks application is booted hard to implement Expiration model expires cache-control drawback no control on invalidation
  • 10. cache model In a real world Backend can't validate every cache HIT Life time is not predictable BUT Varnish can be requested to partially invalidate responses Backend knows when resources change Responses are build on top of resources
  • 11. curl -I "http://varnish.myapp.com/c" curl -I "http://varnish.myapp.com/b" curl -I "http://varnish.myapp.com/a" HTTP/1.1 200 OK Cache-Control: public, s-maxage=3600 X-Cache-Tags: Foo,Bar HTTP/1.1 200 OK Cache-Control: public, s-maxage=3600 X-Cache-Tags: Foo Varnish tags curl -X "BAN" -H "X-Cache-Tags: Foo" "http://varnish.myapp.com" HTTP/1.1 200 OK Cache-Control: public, s-maxage=3600 X-Cache-Tags: Bar,Qux
  • 12. Varnish tags curl "http://varnish.myapp.com/posts/42" HTTP/1.1 200 OK Cache-Control: public, s-maxage=86400 X-Cache-Tags: Post:42,Author:12,Comment:314,Comment:1337 { "id": 42, "title": "My blog post.", "body": "Lorem Ipsum.", "author": { "id": 12, "username": "jderusse" }, "comments": [ { "id": 314, "message": "Wow such post" }, { "id": 1337, "message": "much performance" } ] }
  • 13. Automate Tagging Tagging Response 1. Collect displayed resources 2. Generate resource identifier 3. Tag response
  • 14. Automate Tagging Tagging Response - 1. Collect displayed resources namespace AppEventListener; use JMSSerializerEventDispatcherEvents; use JMSSerializerEventDispatcherEventSubscriberInterface; use JMSSerializerEventDispatcherObjectEvent; class SerializationTagListener implements EventSubscriberInterface { public function onPostSerialize(ObjectEvent $event) { $resource = $event->getObject(); // TODO } public static function getSubscribedEvents() { return [ [ 'event' => Events::POST_SERIALIZE, 'format' => 'json', 'method' => 'onPostSerialize', ], ]; } }
  • 15. Automate Tagging Tagging Response - 2. Generate resource identifier namespace AppEventListener; use AppTagTagExtractorInterface; use FOSHttpCacheBundleHandlerTagHandler; use JMSSerializerEventDispatcherEventSubscriberInterface; use JMSSerializerEventDispatcherObjectEvent; class SerializationTagListener implements EventSubscriberInterface { private $tagExtractor; public function __construct(TagExtractorInterface $tagExtractor) { $this->tagExtractor = $tagExtractor; } public function onPostSerialize(ObjectEvent $event): void { //... $tags = $this->tagExtractor->extract($event->getObject()); } //... }
  • 16. Automate Tagging Tagging Response - 3. Tag response namespace AppEventListener; use AppTagTagExtractorInterface; use FOSHttpCacheBundleHandlerTagHandler; use JMSSerializerEventDispatcherEventSubscriberInterface; use JMSSerializerEventDispatcherObjectEvent; class SerializationTagListener implements EventSubscriberInterface { private $tagExtractor; private $tagHandler; public function __construct(TagExtractorInterface $tagExtractor, TagHandler $tagHandler) { $this->tagExtractor = $tagExtractor; $this->tagHandler = $tagHandler; } public function onPostSerialize(ObjectEvent $event): void { $tags = $this->tagExtractor->extract($event->getObject()); $this->tagHandler->addTags($tags); } //... }
  • 17. Automate Tagging Tagging Response 1. Collect displayed resources 2. Generate resource identifier 3. Tag response Invalidate cache 1. Listen changes 2. Generate resource identifier 3. Call varnish
  • 18. Automate Tagging Invalidate Cache - 1. Listen changes namespace AppEventListener; use DoctrineCommonEventSubscriber; use DoctrineORMEventOnFlushEventArgs; use DoctrineORMEvents; class DoctrineInvalidationTagListener implements EventSubscriber { public function getSubscribedEvents() { return [Events::onFlush]; } public function onFlush(OnFlushEventArgs $eventArgs) { $uow = $eventArgs->getEntityManager()->getUnitOfWork(); foreach ($uow->getScheduledEntityUpdates() as $resource) { // TODO } foreach ($uow->getScheduledEntityDeletions() as $resource) { // TODO } } }
  • 19. Automate Tagging Invalidate Cache - 2. Generate resource identifier namespace AppEventListener; use AppTagTagExtractorInterface; use DoctrineCommonEventSubscriber; class DoctrineInvalidationTagListener implements EventSubscriber { private $tagExtractor; public function __construct(TagExtractorInterface $tagExtractor) { $this->tagExtractor = $tagExtractor; } public function onFlush(OnFlushEventArgs $eventArgs) { $uow = $eventArgs->getEntityManager()->getUnitOfWork(); $tags = []; foreach ($uow->getScheduledEntityUpdates() as $resource) { $tags = array_merge($tags, $this->tagExtractor->extract($resource)); } foreach ($uow->getScheduledEntityDeletions() as $resource) { $tags = array_merge($tags, $this->tagExtractor->extract($resource)); } // TODO } }
  • 20. Automate Tagging Invalidate Cache - 3. Call varnish namespace AppEventListener; use AppTagTagExtractorInterface; use DoctrineCommonEventSubscriber; use FOSHttpCacheHandlerTagHandler; class DoctrineInvalidationTagListener implements EventSubscriber { private $tagExtractor; public function __construct(TagExtractorInterface $tagExtractor, TagHandler $tagHandler) { $this->tagExtractor = $tagExtractor; $this->tagHandler = $tagHandler; } public function onFlush(OnFlushEventArgs $eventArgs) { // ... $this->tagHandler->invalidateTags($tags); } }
  • 21. Automate Tagging Tagging Response 1. Collect displayed resources 2. Generate resource identifier 3. Tag response Invalidate cache 1. Listen changes 2. Generate resource identifier 3. Call varnish Enjoy
  • 22. Silver bullet? Works well when HIT >> MISS Read >> Write Application knows resources used to build response Drawback Operations are not Atomic Backend handles writes Backend knows infrastructure It slows writes
  • 24. Demo Hardware Raspberry Pi Orange Pi docker MySQL NGINX PHP7-FPM Varnish $9.59
  • 25. Demo
  • 26. ab -n 8000 -c 26 192.168.1.17:81/comments/1 This is ApacheBench, Version 2.3 <$Revision: 1757674 $> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net Licensed to The Apache Software Foundation, http://www.apache.org/ Server Software: nginx/1.10.3 Server Hostname: 192.168.1.16 Server Port: 80 Document Path: /comments/1 Document Length: 576 bytes Concurrency Level: 26 Time taken for tests: 26.912 seconds Complete requests: 200 Failed requests: 0 Total transferred: 193400 bytes HTML transferred: 115200 bytes Requests per second: 7.43 [#/sec] (mean) Time per request: 3498.553 [ms] (mean) Time per request: 134.560 [ms] (mean, across all concurrent Transfer rate: 7.02 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 1 2 1.4 1 6 Processing: 546 3342 1156.7 3020 7204 Waiting: 546 3342 1156.7 3020 7204 Total: 550 3344 1156.5 3021 7205 in numbers ab -n 8000 -c 26 192.168.1.17/comments/1 This is ApacheBench, Version 2.3 <$Revision: 1757674 $> Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net Licensed to The Apache Software Foundation, http://www.apache.org/ Server Software: nginx/1.10.3 Server Hostname: 192.168.1.17 Server Port: 80 Document Path: /comments/1 Document Length: 576 bytes Concurrency Level: 26 Time taken for tests: 2.340 seconds Complete requests: 8000 Failed requests: 0 Total transferred: 8948504 bytes HTML transferred: 4608000 bytes Requests per second: 3418.52 [#/sec] (mean) Time per request: 7.606 [ms] (mean) Time per request: 0.293 [ms] (mean, across all concurrent Transfer rate: 3734.21 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 0 2 0.8 2 7 Processing: 2 5 3.3 5 55 Waiting: 2 5 3.3 4 55 Total: 2 8 3.3 7 56 app varnish