Re: PHP Performance/Scalability

[email protected] (Deepak Goel)
Newsgroups php.general
Message-ID <CA+b7NVUA7JzL0k8-6B6CEi2vT5tPBeFunsUiK-NQGfcm_=MqWA@mail.gmail.com>
Hello

1. We tried increasing the number of php workers. It didn't help.

2. We increased the number of vm's (horizontal scaling) and that worked.
But I am more interested in Vertical-scaling. As management of
horizontal-scaling becomes cumbersome.

3. The DB server performed ok. It is not the bottleneck. In Java
application, the number of same queries gave excellent response times.

4. I tried increasing the memory of PHP but it didn't help.

5. The code is fairly simple (a few images, a simple query) so I doubt that
is creating the performance problem.

Btw,

We are using: Apache 2.4.41, PHP 7.2, CodeIgniter 3.1, MySQL 8.0.27
(Could CodeIgniter be the problem?)

Deepak
"The greatness of a nation can be judged by the way its animals are treated
- Mahatma Gandhi"

+91 73500 12833
[email protected]

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 4:58 PM shiplu <[email protected]> wrote:

> It seems like the average response time is at the expected level when the
> number of concurrent users is below 1500. Then it's better you increase the
> number of PHP workers. Now if you have W workers create 6xW workers. If
> each worker receives a max of 1000 requests then you achieve the target
> concurrency.  What does this worker mean depends on your deployment? If you
> have 10 workers behind 1 apache/nginx instance in a single VM, then either
> you increase that 10 PHP workers to 60 or use 6 VMS instead of 1. This is
> the easiest way to solve this problem.
>
> The hardest way is to line up all the components for a single request and
> then find which component is getting hurt when concurrency hits 1500. It
> can be the database. It can be the memory in the DB server, it can be a
> memory in the PHP application server, it can be inefficient code written by
> a junior developer.
>
> Let me know if that helps.
> ―
> Shiplu.Mokadd.im
> Senior Unix Hacker
>
> *Innovation distinguishes between follower and leader*
> —  Steve Jobs
>
>
> *An expert is a person who has made all the mistakes that can be made in a
> very narrow field.*—  Niels Bohr
>
>
> On Tue, Oct 26, 2021 at 12:22 PM Deepak Goel <[email protected]> wrote:
>
>> Hello
>>
>> When we throw 5 to 10 concurrent requests/sec, the response times are in
>> ms for php as well as java. As we increase the load to 1500
>> concurrent users for php, the response times climb to 2-3 seconds. We would
>> like to serve 6000+ concurrent users with millisecond response times for
>> php (same as java).
>>
>> Thanks.
>>
>>
>> Deepak
>> "The greatness of a nation can be judged by the way its animals are
>> treated - Mahatma Gandhi"
>>
>> +91 73500 12833
>> [email protected]
>>
>> 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 3:48 PM shiplu <[email protected]> wrote:
>>
>>> > Average Response Time for PHP pages is 2-3 seconds for 1500 concurrent
>>> users (150 requests/sec).
>>>
>>> This is where the problem lies. The requests are not being finished and
>>> then new requests are coming in. The requests are not being finished
>>> because the first request is slow.
>>>
>>> What is the average response time when you send 5 concurrent requests?
>>> Is it sub 200ms?
>>>
>>> How many users do you want to serve in how many seconds?
>>>
>>> ―
>>> Shiplu.Mokadd.im
>>> Senior Unix Hacker
>>>
>>> *Innovation distinguishes between follower and leader*
>>> —  Steve Jobs
>>>
>>>
>>> *An expert is a person who has made all the mistakes that can be made in
>>> a very narrow field.*—  Niels Bohr
>>>
>>>
>>> On Tue, Oct 26, 2021 at 12:10 PM Deepak Goel <[email protected]> wrote:
>>>
>>>> Hello
>>>>
>>>> 1. Concurrent php requests/sec is 150.
>>>>
>>>> 2. Average Response Time for PHP pages is 2-3 seconds for 1500
>>>> concurrent users (150 requests/sec). If we increase the load beyond 1500
>>>> concurrent users, the response time goes up to 10 seconds for 2000+
>>>> concurrent  users. We also start getting 500 errors as we increase the load
>>>> beyond 2000 concurrent users.
>>>>
>>>> 3. For Java, the response times are in milliseconds even for 6000+
>>>> concurrent users (for the same functionality)
>>>>
>>>> Cheers!
>>>>
>>>> Deepak
>>>> "The greatness of a nation can be judged by the way its animals are
>>>> treated - Mahatma Gandhi"
>>>>
>>>> +91 73500 12833
>>>> [email protected]
>>>>
>>>> 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 3:28 PM shiplu <[email protected]> wrote:
>>>>
>>>>> Hello Deepak,
>>>>>
>>>>> 1500 as concurrency is very very high. It means there are 1500
>>>>> *ongoing* HTTP requests. They started and didn't finish yet at the
>>>>> same time. This can only happen when your average response time is high.
>>>>> What is your average response time?
>>>>>
>>>>> ―
>>>>> Shiplu.Mokadd.im
>>>>> Senior Unix Hacker
>>>>>
>>>>> Meeting Calendar: https://calendar.x.ai/shiplu
>>>>>
>>>>> *Innovation distinguishes between follower and leader*
>>>>> —  Steve Jobs
>>>>>
>>>>>
>>>>> *An expert is a person who has made all the mistakes that can be made
>>>>> in a very narrow field.*—  Niels Bohr
>>>>>
>>>>>
>>>>> On Tue, Oct 26, 2021 at 11:55 AM Deepak Goel <[email protected]>
>>>>> 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?
>>>>>>
>>>>>> Thanks!
>>>>>>
>>>>>> Deepak
>>>>>> "The greatness of a nation can be judged by the way its animals are
>>>>>> treated - Mahatma Gandhi"
>>>>>>
>>>>>> +91 73500 12833
>>>>>> [email protected]
>>>>>>
>>>>>> 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
>>>>>>
>>>>>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.