1 / 39

Asynchronous PHP Myth? Reality!

Asynchronous PHP Myth? Reality!. Alexander Lisachenko, Head of Sowtware Architecture at Alpari (RU). About me. About me. Technology Evolution. Technology Evolution. What should we expect in the nearest future?. Technology trends. PHP World. Simple example. What if sharding ?.

africa
Download Presentation

Asynchronous PHP Myth? Reality!

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Asynchronous PHPMyth? Reality! Alexander Lisachenko, Head of Sowtware Architecture at Alpari (RU)

  2. About me

  3. About me

  4. Technology Evolution

  5. Technology Evolution

  6. What should we expectin the nearest future?

  7. Technology trends

  8. PHP World

  9. Simple example What if sharding? What if unavailable? Highload?

  10. Blocking IO

  11. What is the solution?

  12. Asynchronous PHP • Soap one-way calls • CLI processes: exec, popen, proc_open • CLI signals: pcnt_signal_dispatch, ticks, register_tick_function • Message Queues • DB: reap_async_query, mysqli_poll, pg_send_query • Selecting: curl_multi_select, socket_select, stream_select, stream_set_blocking • Threads (pthreads extension)

  13. One-way SOAP call

  14. One-way SOAP call No output is defined for the operation

  15. One-way SOAP call Works only in WSDL-mode, so need an WSDL (Zend_AutoDiscover): Only “input” part is defined for one-way call

  16. One-way SOAP call – client side

  17. CLI tools

  18. Processes

  19. Processes. Elementary

  20. Processes. Intermediate Non-blocking stream, we can query it later asynchronously with stream_select()

  21. Processes. Intermediate stream_select() goodness POSIX signals

  22. Processes. POSIX signals

  23. Processes. POSIX signals

  24. Signal handling issue in the code PHP will hang until loop is finished and will ignore signals

  25. Asynchronous signal handling Enable support for tick handler and async signal handling.

  26. Asynchronous PHP. Enterprise way.

  27. Asynchronous PHP. Enterprise way. Publishers Subscribers Message Queue PHP App1 PHP App4 PHP App2 PHP App5 PHP App3 PHP App6 STOMP, WebSocket, AMQP

  28. Asynchronous PHP. Enterprise way.

  29. Asynchronous PHP. Enterprise way.

  30. Asynchronous data access in PHP

  31. Asynchronous data access in PHP Like typical stream_select() call

  32. Asynchronous PHP. Cutting-edge.

  33. Asynchronous PHP. Cutting-edge. True threads in PHP! Just call a function in the separate thread Thread syncrhronization

  34. Asynchronous PHP. Cutting-edge. yields a thread-coroutine

  35. Asynchronous PHP. Cutting-edge.

  36. Threaded asynchronous socket server Non-blocking server Our threaded server Effective epoll() loop in libevent

  37. Threaded asynchronous socket server Non-blocking connection

  38. Threaded asynchronous socket server Each connection is handled in separate thread Separate loop for each connection

  39. Thanks! Questions? Alexander Lisachenko Twitter: https://twitter.com/lisachenko Github: https://github.com/lisachenko

More Related