CodeIgniter Forums
Suggestion regarding codeigniter 4 - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forum-28.html)
+--- Forum: CodeIgniter 4 Feature Requests (https://forum.codeigniter.com/forum-29.html)
+--- Thread: Suggestion regarding codeigniter 4 (/thread-69517.html)



Suggestion regarding codeigniter 4 - bawa_d - 12-07-2017

Dear CI devs congratulations for CI4 from the bottom of my heart.

As the php 7.1 have huge performance comparatively to php 5.x there is a new project for asynchronous php on github which is equivalent to Nodejs.

please find below official link
https://reactphp.org/

github repos:
https://github.com/reactphp

framework equivalent to express.js
https://github.com/CapMousse/React-Restify

please have a look so the CI4 can be able to use full asynchronous features of php within the framework.

you did nice job as always.

with regards,
deepak bawa


RE: Suggestion regarding codeigniter 4 - skunkbad - 12-07-2017

Can you give an example of a benefit of asynchronous PHP?


RE: Suggestion regarding codeigniter 4 - twpmarketing - 12-07-2017

I've been looking for something to let me avoid Javascript in my designs.

I found this about asynchronous PHP.

https://www.phproundtable.com/episode/asynchronous-php

It is not yet supported in the PHP code, but it could be.


RE: Suggestion regarding codeigniter 4 - kilishan - 12-07-2017

Nice link twpmarketing! I'll have to watch it a bit later. Although as far as the original post goes - it looks like icicle might provide the drop-in solution he's looking for.

This definitely isn't something in the immediate roadmap for CodeIgniter. We've got enough on our plate just trying to get v4 out the door without adding to the complexity with something more like that.


RE: Suggestion regarding codeigniter 4 - bawa_d - 12-07-2017

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/super-speed-sf-react-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/php-high-performance.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-phpixie-performance-with-reactphp.html

Benchmarks
https://philsturgeon.uk/php/2013/11/12/benchmarking-codswallop-nodejs-v-php/