Welcome Guest, Not a member yet? Register   Sign In
CI4 can be able to use full asynchronous features of php within the framework
#5

(This post was last modified: 12-08-2017, 02:42 AM by bawa_d.)

skunkbad
Can you give an example of a benefit of asynchronous PHP?
thanx for your reply dear.


Yes.
ReactPHP is very much inspired by node.js, which follows the same principle. The goal of such event-based patterns is not to exploit your server 16 CPU's, but to exploit fully your processor by processing HTTP request B while your controller for request A, which has made request to database, is paused until the 'database request success' event is called.
Your test is going exactly against the assumption made by node.js and ReactPHP: "computation is fast, I/O are slow", so if we do computation during I/O (and not between I/O), then CPU time will always be available in higher quantity than needed.
With node.js or ReactPHP if you want to use your server 16 CPU, you just launch 16 server process on 16 port and put a load balancer like nginx in front of them.
But keep in mind ReactPHP is still experimental and not ready for production.

please find below links
There's no denial, we've made use of our potential to achieve Super Speed: by converting our application into a HTTP server using ReactPHP we improved our Symfony application by 8!

Php
Requests per second: 273.76 #/sec
Time per request: 3.653 ms

Wall Time: 12.5ms
CPU Time: 11.4ms
I/O Time: 1.09ms
Memory: 2.2MB


ReactPhp
Requests per second: 2098.17 #/sec
Time per request: 0.477 ms

Wall Time: 1.51ms
CPU Time: 1.51ms
I/O Time: 0.001ms
Memory: 0.105MB

https://gnugat.github.io/2016/04/13/supe...t-php.html


You’ll get with this approach almost 2.000 requests/s instead of 130 on a large Symfony app.
http://marcjschmidt.de/blog/2014/02/08/p...mance.html

A simple benchmark reported about an 800% performance increase, which is a rather obvious result considering that each request now executes a far less amount a code.
https://phpixie.com/blog/increasing-phpi...ctphp.html

Benchmarks
https://philsturgeon.uk/php/2013/11/12/b...ejs-v-php/
Reply


Messages In This Thread
RE: Suggestion regarding codeigniter 4 - by bawa_d - 12-07-2017, 10:35 PM



Theme © iAndrew 2016 - Forum software by © MyBB