Re: 回复: PHP Performance/Scalability
| From: | Jose Nobile | Date: | Fri, 29 Oct 2021 16:14:54 +0000 |
| Subject: | Re: 回复: PHP Performance/Scalability | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-327804@lists.php.net to get a copy of this message | ||
Hello Deepak,
2. OK
3. By execution time I mean how long takes to execute the Java application
isolating it from 'HTTP Time" check this out to execute the .jsp from cli:
https://stackoverflow.com/a/23550396 and
https://docs.oracle.com/cd/E19146-01/821-0790/abxcc/index.html
TTFB = "time_starttransfer" - time_pretransfer -> Taking from the 'curl'
PHP Execution = time php script.php (user + sys time)
HTTP Time = TTFB - PHP Execution
If not possible to execute the Java App from cli, then:
Execution time for the Java App = Java TTFB - "HTTP time" (Calculated from
the PHP Execution)
It will be an assumption, since the JAVA <-> HTTP connection is very
different from PHP <-> HTTP Connection
Then, try to get the Java Execution time from cli
---
Looks like my guess of having 4 CPU (2 Core * 2 threads) was right.
Regards,
José Nobile
On Fri, Oct 29, 2021 at 3:22 AM Deepak Goel <deicool@gmail.com> wrote:
> Hello Jose
>
> 1. We are using Apache FPM
>
> 2. TTFB for both the apps will need some work from my side
>
> 3. Sorry, I am a bit confused, what do you mean by *execution time*?
>
> 4. Machine Configuration:
>
> Architecture: x86_64
> CPU op-mode(s): 32-bit, 64-bit
> Byte Order: Little Endian
> Address sizes: 46 bits physical, 48 bits virtual
> CPU(s): 4
> On-line CPU(s) list: 0-3
> Thread(s) per core: 2
> Core(s) per socket: 2
> Socket(s): 1
> NUMA node(s): 1
> Vendor ID: GenuineIntel
> CPU family: 6
> Model: 79
> Model name: Intel(R) Xeon(R) CPU E5-2686 v4 @ 2.30GHz
>
> (Please note, the cpu utilisation never goes beyond 10-15% even if the
> load is increased to 6000 users from 1500 users)
>
> Thank You.
>
> Deepak
> "The greatness of a nation can be judged by the way its animals are
> treated - Mahatma Gandhi"
>
> +91 73500 12833
> deicool@gmail.com
>
> 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 Fri, Oct 29, 2021 at 12:37 PM Jose Nobile <jose.nobile@gmail.com>
> wrote:
>
>> Hello Deepak,
>>
>> 26 msecs -> 38 reqs/sec/thread -> If a CPU with 16 threads, then 615
>> reqs/sec
>> You are reaching 150 reqs/sec, it can mean:
>> 1. You have 4 threads CPU (2 Core * 2 Threads or 4 Core * 1 Thread)
>> 2. If you have 16 threads, but the HTTP -> PHP Connection is taking about
>> 80 msecs
>>
>> Questions:
>>
>> 1. How many CPU Threads does the system have?
>> 2. How are you connecting HTTP to PHP? Apache mod_php, Apache/NGINX FPM,
>> Apache mod_lsapi or Litespeed webserver?
>>
>> The jsp execution by cli was not successful, check this:
>> https://stackoverflow.com/a/23550396 and
>>
>> https://docs.oracle.com/cd/E19146-01/821-0790/abxcc/index.html
>>
>> If not possible execute java from cli, the closest thing is to measure
>> the TTFB (Time to first byte):
>>
>> A one time step:
>> echo "time_namelookup: %{time_namelookup}\n
>> time_connect: %{time_connect}\n
>> time_appconnect: %{time_appconnect}\n
>> time_pretransfer: %{time_pretransfer}\n
>> time_redirect: %{time_redirect}\n
>> time_starttransfer: %{time_starttransfer}\n
>> ----------\n
>> time_total: %{time_total}\n" > curl-format.txt
>>
>> you should see:
>> cat curl-format.txt
>> time_namelookup: %{time_namelookup}\n
>> time_connect: %{time_connect}\n
>> time_appconnect: %{time_appconnect}\n
>> time_pretransfer: %{time_pretransfer}\n
>> time_redirect: %{time_redirect}\n
>> time_starttransfer: %{time_starttransfer}\n
>> ----------\n
>> time_total: %{time_total}\n
>>
>> Then,
>>
>> curl -4 -sH 'Accept-encoding: br,gzip' -w "@curl-format.txt" -o
>> /dev/null
>> -s https://localhost/yourpathtojava
>>
>> My output from a PHP application connected via Litespeed Enterprise:
>>
>> time_namelookup: 0.060
>> time_connect: 0.060
>> time_appconnect: 0.125
>> time_pretransfer: 0.125
>> time_redirect: 0.000
>> time_starttransfer: 0.125
>> ----------
>> time_total: 0.126
>>
>> It means the TTFB is 126-60 = 65 msecs is the time between the HTTP
>> Request is sent and the response from the webapp starts answering (returns
>> the first byte)
>>
>> Then, we could assume 65 msecs is the execution time itself from the
>> webapp (PHP or Java)
>>
>> It would be the nearest measurement if the app cannot run from cli. BUT,
>> If I run the same script which from the HTTP interface give me a 65 msecs
>> TTFB:
>>
>> time php index.php > /dev/null
>>
>> real 0m0.029s
>> user 0m0.017s
>> sys 0m0.012s
>>
>> It means the HTTP interface is taking about 36 msecs (HTTP decode + TLS
>> decryption) "HTTP Time"
>>
>> Test the TTFB for both apps, calculate the "HTTP time" for PHP, then the
>> execution time for the Java App would be TTFB - "HTTP time" (Calculated
>> from the PHP Execution).
>>
>> 3. What is the TTFB for both apps?
>> 4. What is the execution time for both apps?
>>
>>
>> Regards,
>> José Nobile
>>
>>
>> On Fri, Oct 29, 2021 at 1:28 AM Deepak Goel <deicool@gmail.com> wrote:
>>
>>> Hello
>>>
>>> For php (time php login.php):
>>>
>>> real 0m0.026s
>>> user 0m0.012s
>>> sys 0m0.014s
>>>
>>> For Java (time java login.jsp):
>>>
>>> Error: Could not find or load main class login.jsp
>>> Caused by: java.lang.ClassNotFoundException: login.jsp
>>>
>>> Deepak
>>> "The greatness of a nation can be judged by the way its animals are
>>> treated - Mahatma Gandhi"
>>>
>>> +91 73500 12833
>>> deicool@gmail.com
>>>
>>> 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:46 PM Deepak Goel <deicool@gmail.com> wrote:
>>>
>>>> Hi
>>>>
>>>> Let me check it out. Will get back.
>>>>
>>>> Also, has anyone deployed PHP and it has scaled vertically to a higher
>>>> number of users? Can you please post the results and the machine
>>>> configuration details? It will help.
>>>>
>>>> Thanks.
>>>>
>>>> On Thu, 28 Oct 2021, 23:39 Jose Nobile, <jose.nobile@gmail.com> wrote:
>>>>
>>>>> Hi,
>>>>> I have read all the threads, I'm updated!
>>>>>
>>>>> The waits that I've mentioned before are a signal that can prevent you
>>>>> from using the available CPU. For example, what ifis the PHP has to read
>>>>> an external HTTP resource that needs to fetch? It will be in the wait time
>>>>> (network IO), rather than be speculative, test it.
>>>>>
>>>>> You should execute the exact same code when executing from cli than
>>>>> the HTTP interface, just to isolate the issue and some tests.
>>>>>
>>>>>
>>>>> Regards,
>>>>> José Nobile
>>>>>
>>>>>
>>>>> On Thu, Oct 28, 2021 at 12:43 PM Deepak Goel <deicool@gmail.com>
>>>>> wrote:
>>>>>
>>>>>> Hello Jose
>>>>>>
>>>>>> 1. Got it! I will try this tom afternoon (IST) and pass on the
>>>>>> results.
>>>>>>
>>>>>> 2. However most of the php scripts are called from the web and not
>>>>>> the command line. Also not all the methods are called. Typically, 1 out of
>>>>>> 10 methods are called. (I am unsure how this would compare with the cli
>>>>>> time command). I guess we would have to divide by 10.
>>>>>>
>>>>>> 3. Also there is plenty of CPU available when I run a performance
>>>>>> test on PHP. Only 10-15% is consumed. This would indicate that there is
>>>>>> some synchronization happening in the PHP Infrastructure which is
>>>>>> preventing the full usage of CPU (I don't see this in Java).
>>>>>>
>>>>>> 4. If I run a Java test, the result scales upto 6000+ users. For PHP,
>>>>>> everything remains the same (code, cpu, db) but it scales only to 1500
>>>>>> users. There is no IO wait. And CPU/Memory are utilized only to 15%.
>>>>>>
>>>>>> Thanks!
>>>>>>
>>>>>> Deepak
>>>>>> "The greatness of a nation can be judged by the way its animals are
>>>>>> treated - Mahatma Gandhi"
>>>>>>
>>>>>> +91 73500 12833
>>>>>> deicool@gmail.com
>>>>>>
>>>>>> 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 9:05 PM Jose Nobile <jose.nobile@gmail.com>
>>>>>> wrote:
>>>>>>
>>>>>>> Hello Deepak,
>>>>>>>
>>>>>>> Test it using cli
>>>>>>>
>>>>>>> > time php yourscript.php
>>>>>>>
>>>>>>> What are the results for the time command?
>>>>>>>
>>>>>>> For example:
>>>>>>> time /opt/alt/php80/usr/bin/php test.php
>>>>>>> 1
>>>>>>> real 0m0.010s
>>>>>>> user 0m0.006s
>>>>>>> sys 0m0.003s
>>>>>>>
>>>>>>> It means each request is going to take 6 msecs from Linux user CPU
>>>>>>> + 3 msecs from Linux system CPU + 1 msec from IO or other waits.
>>>>>>>
>>>>>>> You should compare this to the Java applications testing in the same
>>>>>>> way, cli, no other process should be running (just the kernel and sys
>>>>>>> processes).
>>>>>>>
>>>>>>> In this example, each request can be completed in 9 msecs from CPU +
>>>>>>> 1 msec from waits, at CPU level, it can handle 100 requests/sec per CPU
>>>>>>> thread, if it is a 16 threads CPU, it could handle 1600 reqs/sec
>>>>>>>
>>>>>>> The HTTP interface can add some CPU, also the TLS (Elliptic curve
>>>>>>> are super fast, or the ciphers for TLS 1.3), it got under 1 msec when
>>>>>>> the
>>>>>>> HTTP interface is LSAPI from Litespeed Enterprise, which better than
>>>>>>> PHP-FPM, but first focus in the program itself, testing from cli, each
>>>>>>> individual requests optimizing at all levels, a kernel updated, NVMe
>>>>>>> for
>>>>>>> storage, DDR4 ECC 2933MHz, just loading the required PHP extensions,
>>>>>>> profiling SQL queries to be as efficient as possible anything from 1
>>>>>>> msec
>>>>>>> or more can represent hundreds of potential more reqs/sec.
>>>>>>>
>>>>>>> What are the results of the PHP and the Java program executed from
>>>>>>> cli in a dedicated system?
>>>>>>>
>>>>>>>
>>>>>>> Regards,
>>>>>>> José Nobile
>>>>>>>
>>>>>>>
>>>>>>> On Thu, Oct 28, 2021 at 8:28 AM Deepak Goel <deicool@gmail.com>
>>>>>>> wrote:
>>>>>>>
>>>>>>>> Hello Shiplu
>>>>>>>>
>>>>>>>> The resources mentioned by you are not a bottleneck. There is
>>>>>>>> plenty of it available.
>>>>>>>>
>>>>>>>> Deepak
>>>>>>>> "The greatness of a nation can be judged by the way its
>>>>>>>> animals
>>>>>>>> are treated - Mahatma Gandhi"
>>>>>>>>
>>>>>>>> +91 73500 12833
>>>>>>>> deicool@gmail.com
>>>>>>>>
>>>>>>>> Facebook: https://www.facebook.com/deicoolõA¸¿ª*N
>>>>>>>> —Ô|=
>>>>>>>> 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 2:15 PM shiplu <shiplu.net@gmail.com>
>>>>>>>> wrote:
>>>>>>>>
>>>>>>>>> Hello Deepak,
>>>>>>>>>
>>>>>>>>> If the code itself has a performance problem then it would show
>>>>>>>>> up
>>>>>>>>> even when the concurrency is 1. But it shows the issue when
>>>>>>>>> concurrency
>>>>>>>>> hits 1500. From 1 to 1500 there is the number when the response
>>>>>>>>> time starts
>>>>>>>>> to increase. That's where the problem arises. You
>>>>>>>>> mentioned it worked when
>>>>>>>>> increased the number of VMs. Check the system resource
>>>>>>>>> statistics when you
>>>>>>>>> are requesting to multiple VMs and a single VM.
>>>>>>>>>
>>>>>>>>> It can happen that a metric is very high when you are using a
>>>>>>>>> single VM solution with 1500 concurrent requests. And the same
>>>>>>>>> metric would
>>>>>>>>> be very low in horizontal scaling setup. Some of these metrics
>>>>>>>>> can be
>>>>>>>>> 1. CPU
>>>>>>>>> 2. Memory
>>>>>>>>> 3. IOWait time
>>>>>>>>> 4. Request Queue size
>>>>>>>>> 5. Open file descriptors
>>>>>>>>> This is a metric you need to find out yourself. Once you find
>>>>>>>>> the
>>>>>>>>> metric you'll know horizontal scaling made it possible to
>>>>>>>>> lower it. Then
>>>>>>>>> for vertical scaling, you just need to increase that.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> ―
>>>>>>>>> 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 Thu, Oct 28, 2021 at 9:35 AM Deepak Goel
>>>>>>>>> <deicool@gmail.com>
>>>>>>>>> wrote:
>>>>>>>>>
>>>>>>>>>> We are using CodeIgniter 3.1.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Deepak
>>>>>>>>>> "The greatness of a nation can be judged by the way
>>>>>>>>>> its animals
>>>>>>>>>> are treated - Mahatma Gandhi"
>>>>>>>>>>
>>>>>>>>>> +91 73500 12833
>>>>>>>>>> deicool@gmail.com
>>>>>>>>>>
>>>>>>>>>> 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 1:03 PM Torsten Rosenberger <
>>>>>>>>>> rosenberger@taoweb.at> wrote:
>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> >
>>>>>>>>>>> > 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@gmail.com
>>>>>>>>>>> >
>>>>>>>>>>> > 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@taoweb.at> 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@gmail..com>;
>>>>>>>>>>> > > > 发送时间:
>>>>>>>>>>> > > > 2021年10月26日(星期二) 晚上11:15
>>>>>>>>>>> > > > 收件人:
>>>>>>>>>>> > > > "Alex"<al-php@none.at>;
>>>>>>>>>>> > > > 抄送: "php-general General
>>>>>>>>>>> > > > List"<php-general@lists.php.net
>>>>>>>>>>> >;"Deepak
>>>>>>>>>>> > > > Sharma"<deepak@techxp.tech>;
>>>>>>>>>>> > > > 主题: 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@gmail.com
>>>>>>>>>>> > > >
>>>>>>>>>>> > > > 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@none.at>
>>>>>>>>>>> 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@gmail.com
>>>>>>>>>>> > > > > > <mailto:deicool@gmail.com>
>>>>>>>>>>> > > > > >
>>>>>>>>>>> > > > > > 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 <
>>>>>>>>>>> > > > > V$õ»û%RºŒyšZ
>>>>>>>>>>> > > > > 7Ùhttp://www.makeinindia.com/home>
>>>>>>>>>>> > > > >
>>>>>>>>>>> > >
>>>>>>>>>>>
>>>>>>>>>>>