8. PHP 7 facts
isset 1.55 times faster than array_key_exists
is_file 26 times faster than file_exists
single quotes slower that double quotes
instanceof faster is_a
etc.
Code performance?
9. Blackfire.io profile
Current results:
Total request time: 18.4 ms
file_exists called: 7 times
Exec. time for file_exists: 460 µs
Expected results:
Exec/ time: ~17.6 µs
Total request time: ~18.3996 ms
15. 10$
50 RPS
App Server
RAM: 1024
CPU: 1
HDD: 30
50 RPS
App Server
RAM: 512
CPU: 1
HDD: 20
LB Server
RAM: 512
CPU: 1
HDD: 20
16. 15$
100 RPS
App Server
50 RPS
App Server LB Server
5$
App Server
RAM: 512
CPU: 1
HDD: 20
RAM: 512
CPU: 1
HDD: 20
RAM: 512
CPU: 1
HDD: 20
RAM: 1024
CPU: 1
HDD: 30
17. 20$
160 RPS
App Server
120 RPS
App Server LB Server
App Server
App Server
RAM: 2048
CPU: 2
HDD: 40
RAM: 512
CPU: 1
HDD: 20
RAM: 512
CPU: 1
HDD: 20
RAM: 512
CPU: 1
HDD: 20
RAM: 512
CPU: 1
HDD: 20
18. Summary
Often hardware is cheaper than software
Often scaling is cheaper than tuning
Often horizontal scaling wins vertical scaling
Often applications are not scalable :(
27. Benefits we've got
Advanced routing of requests
Advanced routing of responses
Workers could be added dynamically without LB
reconfig
Buffer size by queue limit
Back pressure by message TTL
54. Instead Summary
Scalability as afterwords doesn't work
Database is not a queue
Database is not a lock system
Redis is not a queue
MySQL master is always SPOF
Load balancers as a must
Linear disk writes wins
Perfomance in PHP is done by everything except PHP
Being distributed is fucking hard