SlideShare a Scribd company logo
The journey of a symfony app from 150ms to 20ms
Alex Bumbacea
● Programmer since 2007
● tackled a bit of sysadmin
● telecom/gaming/e-commerce
● Symfony user since 1.4
The journey of a Symfony
app from 150ms to 20ms
The journey of a symfony app from 150ms to 20ms
More context
● Recommandations engine
● API with 2 endpoints
○ /bulk
○ /one
The journey of a symfony app from 150ms to 20ms
xhprof
Prep work
● Smoke tests - fast deployment
● Stable env
● Canary server (⅓ servers at least)
● Monitoring tools
Monitoring tools
● NewRelic
● Grafana
● ELK - monitor error rates
Daily status update
Now Target
99% 4000ms 300ms
95% 3000ms N/A
50% - median 150ms N/A
Throughput 100rps 800rps
The journey of a symfony app from 150ms to 20ms
Take 1
Gearman to parallelize bulk
Findings for take 1
● Increase in throughput
● Bulk response time decreased
● Hard to scale fast
● Consuming a lot of memory
Take 2
Benchmark against java & node js
(with gearman jobs in php)
Original stats
Take 2.1
Upgrade from php 5.6 to 7.0
Some more stats
The journey of a symfony app from 150ms to 20ms
Problems of take 2.1
● Mongo driver support dropped
● Upgrade doctrine mongo bundle
● XHProf tools incompatibility
Findings take 2.1
25% decrease in request timings
Memory usage reduction
Daily status update
Before Now Target
99% 4000ms 3200ms 300ms
95% 3000ms 2000ms N/A
50% - median 150ms 100ms N/A
Throughput 100rps 130rps 800rps
Take 3
Drop gearman and move to multi curl
Findings for take 3
● Increase in throughput
● Better monitoring - bulk was hiding stuff
● Better http cache for our API -> we could use varnish in
front of it
Daily status update
Before Now Target
99% 3200ms 3000ms 300ms
95% 2000ms 2000ms N/A
50% - median 100ms 100ms N/A
Throughput 130rps 200rps 800rps
Connecting / Reconnecting
● Redis
● Mongo
● MySQL
● etc
● Consider connection state (ex: redis selected db)
The journey of a symfony app from 150ms to 20ms
Consider your timeouts
● Solr / Mongo / MySQL / Redis etc
● None of your timeouts should be larger
than your SLA
Network connection: Connection timeout!
The journey of a symfony app from 150ms to 20ms
● XHProf
● NewRelic
Look into dispatched events
● It hides a lot of processing
● Not everything is required every time
Get rid of garbage
- We removed bundles
- SecurityBundle, SwiftMailerBundle, SensioFrameworkExtraBundle, TwigBundle,
AsseticBundle
- Only required services (that don’t have lazy
loading)
- Only required routes
Dedicated kernel (ApiKernel)
- And dedicated cache folder :)
Autoload optimizations
Composer optimize or not?
For our project:
NOT
IO
IO
IO
Queue it!
If you don’t need it now… queue it :)
Slaves. Do you use them?
Config tweaks
● FPM children ++
● Mongo max connections ++
Daily status
Before Now Target
99% 4000ms 280ms 300ms
95% 3000ms 200ms N/A
50% - median 150ms 20ms N/A
Throughput 100rps 500rps 800rps
Add servers
X servers * 2
Daily status - END
Before Target Now
99% 4000ms 300ms 280ms
95% 3000ms N/A 200ms
50% - median 150ms N/A 20ms
Throughput 100rps 800rps 1100rps
The journey of a symfony app from 150ms to 20ms
The journey of a symfony app from 150ms to 20ms
Summary
● Gearman
● Java -> PHP 7
● Gearman -> curl_multi_get
● Connections and timeouts
● ApiKernel
● IO / Memory / FPM
● Horizontal scaling
The journey of a symfony app from 150ms to 20ms
Don’t use those numbers on your app.
Make your own tests.
The journey of a symfony app from 150ms to 20ms
Q&A
https://medium.com/techlabs-emag
https://www.linkedin.com/in/alexbumbacea/
https://github.com/alexbumbacea
Thank you!

More Related Content

PDF
Phpmatsuri2013
PDF
AWS Lambdas are cool - Cheminfo Stories Day 1
PPTX
C100 k and go
ODP
Java Performance: What developers must know
PDF
Performance optimization techniques for Java code
PPTX
Stress driven development
ODP
BAXTER phase 1b
PDF
Play Framework
Phpmatsuri2013
AWS Lambdas are cool - Cheminfo Stories Day 1
C100 k and go
Java Performance: What developers must know
Performance optimization techniques for Java code
Stress driven development
BAXTER phase 1b
Play Framework

What's hot (18)

PPTX
Autonomous workload rebalancing in kafka
PDF
MMS Automation In Action!
PDF
Fast, deterministic, and verifiable computations with WebAssembly
PDF
Benchmarking for HTTP/2
PDF
High performance in react native
PDF
Golden images vs Configuration Mgmt
PDF
From C++ to JS via Emscripten
PDF
OSv Unikernel — Optimizing Guest OS to Run Stateless and Serverless Apps in t...
PPTX
Launching a BPT Process on Entity Update
PDF
MMS Automation In Action!
PPT
Shubhrat mishra working with php 2
PDF
HBaseCon2017 Quanta: Quora's hierarchical counting system on HBase
PDF
Get Lower Latency and Higher Throughput for Java Applications
PPTX
Gearman & PHP
KEY
Cassandra at Twitter - Distributed Counters
PDF
XMPP & AMQP
PPTX
Introduction to stress test
PDF
Training Slides: 104 - Basics - Working With Command Line Tools
Autonomous workload rebalancing in kafka
MMS Automation In Action!
Fast, deterministic, and verifiable computations with WebAssembly
Benchmarking for HTTP/2
High performance in react native
Golden images vs Configuration Mgmt
From C++ to JS via Emscripten
OSv Unikernel — Optimizing Guest OS to Run Stateless and Serverless Apps in t...
Launching a BPT Process on Entity Update
MMS Automation In Action!
Shubhrat mishra working with php 2
HBaseCon2017 Quanta: Quora's hierarchical counting system on HBase
Get Lower Latency and Higher Throughput for Java Applications
Gearman & PHP
Cassandra at Twitter - Distributed Counters
XMPP & AMQP
Introduction to stress test
Training Slides: 104 - Basics - Working With Command Line Tools
Ad

Similar to The journey of a symfony app from 150ms to 20ms (20)

PDF
Netflix Keystone Pipeline at Samza Meetup 10-13-2015
PDF
Gatling - Bordeaux JUG
POTX
IBM Domino / IBM Notes Performance Tuning
PPTX
PDF
Real-time Stream Processing using Apache Apex
PDF
Introduction to Apache Apex - CoDS 2016
PDF
Rate limits and Performance
PDF
Reactive mistakes - ScalaDays Chicago 2017
PDF
Extreme HTTP Performance Tuning: 1.2M API req/s on a 4 vCPU EC2 Instance
PDF
Building a Network IP Camera using Erlang
PDF
Practice and challenges from building IaaS
ODP
Optimizing Linux Servers
PDF
Velocity 2018 preetha appan final
PDF
Distributed Queue System using Gearman
PDF
Varnish - PLNOG 4
PDF
Managing 600 instances
PPT
z/VM Performance Analysis
PDF
Server fleet management using Camunda by Akhil Ahuja
PDF
Strata Singapore: Gearpump Real time DAG-Processing with Akka at Scale
PDF
Couchbase live 2016
Netflix Keystone Pipeline at Samza Meetup 10-13-2015
Gatling - Bordeaux JUG
IBM Domino / IBM Notes Performance Tuning
Real-time Stream Processing using Apache Apex
Introduction to Apache Apex - CoDS 2016
Rate limits and Performance
Reactive mistakes - ScalaDays Chicago 2017
Extreme HTTP Performance Tuning: 1.2M API req/s on a 4 vCPU EC2 Instance
Building a Network IP Camera using Erlang
Practice and challenges from building IaaS
Optimizing Linux Servers
Velocity 2018 preetha appan final
Distributed Queue System using Gearman
Varnish - PLNOG 4
Managing 600 instances
z/VM Performance Analysis
Server fleet management using Camunda by Akhil Ahuja
Strata Singapore: Gearpump Real time DAG-Processing with Akka at Scale
Couchbase live 2016
Ad

Recently uploaded (20)

PDF
Paper PDF World Game (s) Great Redesign.pdf
PPTX
innovation process that make everything different.pptx
PDF
Decoding a Decade: 10 Years of Applied CTI Discipline
PPT
Design_with_Watersergyerge45hrbgre4top (1).ppt
PPTX
Job_Card_System_Styled_lorem_ipsum_.pptx
PDF
WebRTC in SignalWire - troubleshooting media negotiation
PPTX
Internet___Basics___Styled_ presentation
PPTX
Power Point - Lesson 3_2.pptx grad school presentation
PDF
Testing WebRTC applications at scale.pdf
PPTX
June-4-Sermon-Powerpoint.pptx USE THIS FOR YOUR MOTIVATION
PPTX
Digital Literacy And Online Safety on internet
PDF
Best Practices for Testing and Debugging Shopify Third-Party API Integrations...
PDF
SASE Traffic Flow - ZTNA Connector-1.pdf
PDF
APNIC Update, presented at PHNOG 2025 by Shane Hermoso
PDF
Introduction to the IoT system, how the IoT system works
PDF
An introduction to the IFRS (ISSB) Stndards.pdf
PPTX
presentation_pfe-universite-molay-seltan.pptx
PDF
Tenda Login Guide: Access Your Router in 5 Easy Steps
PPTX
Introduction to Information and Communication Technology
PPTX
introduction about ICD -10 & ICD-11 ppt.pptx
Paper PDF World Game (s) Great Redesign.pdf
innovation process that make everything different.pptx
Decoding a Decade: 10 Years of Applied CTI Discipline
Design_with_Watersergyerge45hrbgre4top (1).ppt
Job_Card_System_Styled_lorem_ipsum_.pptx
WebRTC in SignalWire - troubleshooting media negotiation
Internet___Basics___Styled_ presentation
Power Point - Lesson 3_2.pptx grad school presentation
Testing WebRTC applications at scale.pdf
June-4-Sermon-Powerpoint.pptx USE THIS FOR YOUR MOTIVATION
Digital Literacy And Online Safety on internet
Best Practices for Testing and Debugging Shopify Third-Party API Integrations...
SASE Traffic Flow - ZTNA Connector-1.pdf
APNIC Update, presented at PHNOG 2025 by Shane Hermoso
Introduction to the IoT system, how the IoT system works
An introduction to the IFRS (ISSB) Stndards.pdf
presentation_pfe-universite-molay-seltan.pptx
Tenda Login Guide: Access Your Router in 5 Easy Steps
Introduction to Information and Communication Technology
introduction about ICD -10 & ICD-11 ppt.pptx

The journey of a symfony app from 150ms to 20ms