Your SlideShare is downloading. ×

Threads in PHP - will change the world

1,226

Published on

In August 2012 Joe Watkins introduced the Pthreads extension for PHP. Since then it is possible to use threads for asynchronous data handling in PHP as well. Now the extension is in a very promising …

In August 2012 Joe Watkins introduced the Pthreads extension for PHP. Since then it is possible to use threads for asynchronous data handling in PHP as well. Now the extension is in a very promising state so it is definitely a look worth. The talk will show you the basics of using threads in PHP on the base of some real world examples. We will also have a look into interesting fields of future use. As parallelization and asynchronity is becoming more and more important this is a good way to step into some very interesting an promising fields.

Published in: Internet, Technology
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,226
On Slideshare
0
From Embeds
0
Number of Embeds
7
Actions
Shares
0
Downloads
9
Comments
0
Likes
2
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Threads in PHP „will changes the world“
  • 2. Stefan Willkommer Co-Founder and CTO w agner_tim 78 @ Tim Wagner Co-Founder and Lead Architect @ sw illkom m er
  • 3. Tiger Sissi me ;) Annette Uschi me ah Tim Barbecue
  • 4. Let’s DIFFERENTIATE
  • 5. EVENTLOOPS
  • 6. FORKS
  • 7. THREADS
  • 8. What is a THREAD
  • 9. Process-Model without THREADS
  • 10. Process-Model with THREADS
  • 11. What do we NEED
  • 12. PHP 5.3+
  • 13. compiled thread-safe --enable-maintainer-zts
  • 14. PECL extension pthreads
  • 15. my first THREAD
  • 16. my first THREAD
  • 17. What is a STACKABLE
  • 18. enabling sharing and synchronizing Data over THREADS
  • 19. tasks which can be processed by a WORKER
  • 20. What can be SHARED
  • 21. everything which is SERIALIZABLE
  • 22. sharing Data with a Stackable
  • 23. sharing Data with a Stackable
  • 24. sharing Data with a Stackable
  • 25. What is a WORKER
  • 26. allows stacking of DATA
  • 27. like a QUEUE
  • 28. using a Worker
  • 29. using a Worker
  • 30. SYNCHRONISATION and CONCURRENCY HANDLING
  • 31. waiting for Threads with join()
  • 32. enables waiting for one or more THREADS
  • 33. makes sure that result is available in THREAD
  • 34. waiting by using Join
  • 35. waiting by using Join
  • 36. waiting by using Join
  • 37. synchronizing Threads with synchronized()
  • 38. synchronize with synchronized()
  • 39. synchronize with synchronized()
  • 40. synchronize with synchronized()
  • 41. concurrency handling by using MUTEX
  • 42. synchronize with Mutex
  • 43. synchronize with Mutex
  • 44. synchronize with Mutex
  • 45. sharing Resources
  • 46. sharing Sockets
  • 47. sharing Sockets
  • 48. sharing Sockets
  • 49. What to do with all these POSSIBILITIES
  • 50. GOOD everything is BAD
  • 51. Runtime ApplicationServer PersistenceContainer Web MQ Objects WebServer Worker Threads Socket! 0.0.0.0:8587 Socket! 0.0.0.0:8585 Socket! 0.0.0.0:8586 HTTPRemoteMethodMessage Timer MBeans! SBeans! ! Worker
  • 52. Performance comparison Test Profile Setup: 1 Webserver + 1 DB Server Virtualisation: KVM / Intel Xeon / 4 Cores OS: Debian wheezy Magento: 1.13.1.0 EE Amount of Products: 10,000 milliseconds 0 65 130 195 260 Homepage Category Page Detailpage AS, mod PHP nginx, PHP FPM
  • 53. The power of MEMORY
  • 54. Performance comparison Test Profile Setup: 1 Webserver + 1 DB Server Virtualisation: KVM / Intel Xeon / 4 Cores OS: Debian wheezy Magento: 1.13.1.0 EE Amount of Products: 10,000 milliseconds 0 65 130 195 260 Homepage Category Page Detailpage AS, Mage Servlet nginx, PHP FPM
  • 55. 60% in average about faster
  • 56. 280% in average about faster
  • 57. What’s NEXT?
  • 58. https://github.com/techdivision/phptek_2014 https://github.com/krakjoe/pthreads https://computing.llnl.gov/tutorials/pthreads/ http://appserver.io https://github.com/techdivision/TechDivision_ApplicationServer Ressources
  • 59. Thank you! Questions?

×