> > Some thoughts: > > 1. We are using a simple SQL Query in the code > $data = $this->db->select('user_id,email') > ->where(array('email' => $email_address)) > ->order_by('user_id', 'DESC') > ->limit(1) > ->get('users') > ->row_array(); looks like you are using laraval so i would start with $start = microtime(true); run you db code and the microtime(true) - $start; and compare this when you rewrite the code with native mysqli functions like mysqli_query I know this is work but so you can get the feeling which one is faster. In small application you use frameworks but there could be cases where a normal function ist much faster as writing a class > > > 2. We are using mysqli > > 3. The SQL Query takes time in msec. And the Database is not a > performance bottleneck That could be OK for the database. But as in point 1. so the query could be fast but the layer above could be slow. I thing when you compare the code sections with microtime you will find the part eating the time in the script. > > 4. We use mostly images with <img src=""> > > 5. We have seen fpm outperform mod_php > > 6. The Java code accesses the same database (The database is on a > seperate physical server). Also the queries are the same in Java as > well PHP > > 7. I will try instrumenting the entire PHP code and see where the > bottleneck is. > > Deepak > "The greatness of a nation can be judged by the way its animals are > treated - Mahatma Gandhi" > > +91 73500 12833 > deicool@xxxxxxxxx > > Facebook: https://www.facebook.com/deicool > LinkedIn: www.linkedin.com/in/deicool > > "Plant a Tree, Go Green" > > Make In India : http://www.makeinindia.com/home > > > On Thu, Oct 28, 2021 at 11:23 AM Torsten Rosenberger < > rosenberger@xxxxxxxxx> wrote: > > Hello Deepak > > > > I think PHP-FPM had heavily reduce the concurrency of PHP. > > > PHP should immediately implement a API like WSGI/ASGI in python. > > It > > > is very simple but very useful. > > > > > > ------------------ 原始邮件 ------------------ > > > 发件人: "Deepak Goel" <deicool@xxxxxxxxx>; > > > 发送时间: 2021年10月26日(星期二) 晚上11:15 > > > 收件人: "Alex"<al-php@xxxxxxx>; > > > 抄送: "php-general General List"<php-general@xxxxxxxxxxxxx>;"Deepak > > > Sharma"<deepak@xxxxxxxxxxx>; > > > 主题: Re: PHP Performance/Scalability > > > > > > Hi > > > > > > The code is fairly simple. It contains a few images and a simple > > SQL > > > query (The same code in Java gives superb performance). We have > > an > > > Apache Web Server in front of php as of now. And I will try out > > this > > > (https://github.com/spiral/roadrunner). > > > > We are talking about a blackbox. > > The code is simple ? > > > > How long take's > > the sql query ? > > What do you use to access the database PDO or mysqli ? > > Y > > ou wrote java is faster. Your java code access the same database ? > > > > You wrote a few images ? > > Do you only show the images with <img src=""> > > or are you converting them for thumbnails etc. > > > > A long time ago there was a great presentation from Rasmus about > > PHP > > Performance. > > > > So a simple query on my Server's with mod_php and mysql > > takes 0.0001 to 0.0008 seconds. If the simple query takes 0.01 > > Second > > which looks fast but php have to wait for the DB. So there you can > > loose factor 100 in the req/sec. > > > > Why are you using fpm and not the mod_php part in apache ? > > OPcache is > > active ? > > > > There are a lot of parameters we don't know. > > > > If you benchmark > > your code with an easy microtime(true) call to see how long your > > script > > takes. > > If you store the data in a file when you run your benchmark you > > can maybe see if a code part is waiting for the database or > > something > > else. > > So that the bottleneck ist not php. > > > > So i would go through the code > > with microtime() an look what takes long and then go deepter. > > > > if the > > code is heavy and the result dosen't change or a refresh after 5 > > min is > > ok you can use the APCu cache or so on. > > > > If your code is super fast an still slow requests then you have to > > strace the apache process to see if there is something miss > > configured. > > > > > > So as a PHP developer we cann't accept that Java is faster :) > > > > BR/Torsten > > > > > Thanks. > > > > > > Deepak > > > "The greatness of a nation can be judged by the way its animals > > are > > > treated - Mahatma Gandhi" > > > > > > +91 73500 12833 > > > deicool@xxxxxxxxx > > > > > > Facebook: https://www.facebook.com/deicool > > > LinkedIn: www.linkedin.com/in/deicool > > > > > > "Plant a Tree, Go Green" > > > > > > Make In India : http://www.makeinindia.com/home > > > > > > > > > On Tue, Oct 26, 2021 at 5:15 PM Alex <al-php@xxxxxxx> wrote: > > > > Hi. > > > > > > > > On 26.10.21 11:53, Deepak Goel wrote: > > > > > Hello > > > > > > > > > > I have a very simple PHP application which I develop on > > Apache- > > > > Web-Server. However the application does > > > > > not scale beyond 1500 concurrent users (150 requests/sec), > > even > > > > though there is plenty of hardware > > > > > available (CPU is getting utilized 15%, Memory is getting > > > > utilized 15%). > > > > > > > > > > On a similar note, when I develop the same application in > > Java, > > > > it scales to more than 6000 concurrent > > > > > users (600 requests/sec) on the same hardware. > > > > > > > > > > Any pointers on how to address this scalability issue? > > > > > > > > The question is how "simple" is the PHP Code? > > > > Maybe you can tune the Code or use another Server in front of > > PHP > > > > FPM like haproxy, Caddy, nginx? > > > > Maybe you can try to run https://github.com/spiral/roadrunner > > to > > > > execute the PHP Code. > > > > > > > > Jm2c > > > > > > > > Regards > > > > Alex > > > > > > > > > Thanks! > > > > > > > > > > Deepak > > > > > "The greatness of a nation can be judged by the way its > > animals > > > > are treated - Mahatma Gandhi" > > > > > > > > > > +91 73500 12833 > > > > > deicool@xxxxxxxxx <mailto:deicool@xxxxxxxxx> > > > > > > > > > > Facebook: https://www.facebook.com/deicool < > > > > https://www.facebook.com/deicool> > > > > > LinkedIn: www.linkedin.com/in/deicool < > > > > http://www.linkedin.com/in/deicool> > > > > > > > > > > "Plant a Tree, Go Green" > > > > > > > > > > Make In India : http://www.makeinindia.com/home < > > > > http://www.makeinindia.com/home> > > > > > >