PHP at Scale:
Knowing enough to be dangerous!
Oleksii Petrov
Skelia Ukraine / ETWater
System Architect
Team Lead
PHP Developer
@alexhelkar
alexhelkar
https://github.com/alexhelkar
* (dramaticaly)
by your stack and software architecture
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
IF Application is SLOW
Enable Caching
IF Application has GLITCHES
Disable Caching
async/semi-sync
Writes
Reads
Reads
aka sync replication
{
"deviceId": 231,
"lat":"45.22838254",
"lng":"-114.23725403",
"timestamp":1459509524,
"temperature":2.99,
"precipProbability":0.386,
"humidity":0.055,
"pressure":1035.617
}
Yandex Tank
75k pack.
75k pack.
Last Resort
<?php
$mysqli = new mysqli("myapp", "user", "password", "database");
mysqlnd_ms_fabric_select_shard($mysqli, "test.fabrictest", 10);
$mysqli->query("INSERT INTO fabrictest(id) VALUES (10)");
mysqlnd_ms_fabric_select_shard($mysqli, "test.fabrictest", 10);
$mysqli->query("SELECT id FROM test WHERE id = 10");
http://php.net/manual/ru/mysqlnd-ms.quickstart.mysql_fabric.php
https://blog.pivotal.io/pivotal/products/rabbitmq-hits-one-million-messages-per-second-on-google-compute-engine
https://engineering.linkedin.com/kafka/benchmarking-apache-kafka-2-million-writes-second-three-cheap-machines
@alexhelkar
alexhelkar
https://github.com/alexhelkar