Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Strike - Yet Another Fast PHP Router -

Sponsored · Your Podcast. Everywhere. Effortlessly. Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.

Strike - Yet Another Fast PHP Router -

Avatar for gourrymk2

gourrymk2

July 31, 2014

Other Decks in Programming

Transcript

  1. Leo 寸永來 Work at S.M.S. Taiwan 知恩思資訊股份有限公司 Senior PHP Developer

    Joomla! 3 / Symfony2 / Doctrine2 / Silex / Node.js GitHub: https://github.com/LeoOnTheEarth
  2. 1. A pure router library (require zero dependency) 2. Easy

    to use 3. Fast enough 4. https://github.com/LeoOnTheEarth/Strike What is Strike?
  3. Optimized mapping (Will implement later) After I figured out this

    implementation, I found it is similar to Symfony.
  4. Benchmark Environment Linode instance • 2 GB RAM • 2

    CPU Cores • SSD Storage • CentOS 6.5 • PHP 5.4.30 • Added 18 patterns Match pattern: “/blog/article/{id}/{title}” Match path: “/blog/article/345/router-benchmarks” Source code: https://github.com/LeoOnTheEarth/StrikeBenchmark
  5. Benchmark Results Run 10000 times in console without cache (less

    is better) Total Match 0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 Strike Pux Symfony response time (ms)
  6. Total Match 0 0.05 0.1 0.15 0.2 0.25 0.3 0.35

    0.4 0.45 0.5 Strike-cache Pux-cache Symfony-cache response time (ms) Benchmark Results Run 10000 times in console with cache (less is better)
  7. Benchmark Results Apache Benchmark Test without cache (more is better)

    ab -c 10 -n 100 ab -c 10 -n 500 ab -c 50 -n 500 ab -c 100 -n 500 0 100 200 300 400 500 600 700 Apache benchmark result (without cache) Strike Pux Symfony Requests per second
  8. Benchmark Results Apache Benchmark Test with cache (more is better)

    ab -c 10 -n 100 ab -c 10 -n 500 ab -c 50 -n 500 ab -c 100 -n 500 0 100 200 300 400 500 600 700 800 Apache benchmark result (with cache) Strike-cache Pux-cache Symfony-cache Requests per second
  9. Benchmark Summary 1. Pux performance is quiet awesome. 2. Router

    match is not a performance issue, it's fast enough 3. We should focus on the performance during router initialization
  10. Strike will continue enhance it's performance Feel free to send

    feedback on GitHub https://github.com/LeoOnTheEarth/Strike