Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
246 views
in Technique[技术] by (71.8m points)

php - Laravel 7.28.4 application has problems with too many JMeter threads at once

We recently updated our server to a much more beefy setup, since we are expecting much higher user numbers. We are running a Laravel 7.28.4 application on the server and the user interacts with it by visiting about 10 web-pages in sequence, where he provides data in 3 of those and posts them to the server, which puts them into the database. The server will then send an email that everything is finished.

Now we did a stresstest with Apache JMeter with almost 130.000 Accesses per hour, where we reproduced exactly this 10 step sequence for every thread. The requests were done in immidiate succession and the server was easily able to handle it. We used about 250 threads here.

HOWEVER if we do a stresstest with only 60000 Accesses per hour with more threads with a waiting-time in between every request, the server gets completely overworked and slow. Many of the requests get an error 503 or 522. Here we used about 500 threads.

While doing theses stresstests the server was on constant 5-6% RAM usage and about 10-12% CPU usage. I don't think the Database/Mailserver/Hardware are bottlenecking if everything worked fine with more requests.

However, I'm guessing Laravel has trouble managing many sessions at once? I have already tried to swap the session driver to database instead of file storage. The result was not better.

Does anybody know what I can do to improve the response time of the server? Or might there be other ideas on why it is struggling with more threads?

Thanks

question from:https://stackoverflow.com/questions/65861045/laravel-7-28-4-application-has-problems-with-too-many-jmeter-threads-at-once

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I don't think using file or database is a proper choice, as per 12 Tips for Laravel Performance Optimization in 2020 article:

Choose a Fast Cache and Session driver

For optimal Laravel performance tuning, the best route is to store the cache and session sections in the RAM. I believe the fastest cache and session drivers for Laravel 5 performance is Memcached.

The driver key for changing the session driver is usually located in app/config/session.php. Likewise, the driver key for changing the cache driver is located in app/config/cache.php

With regards to your test itself, since it does the job it should be fine, however your "Accesses per hour" approach sounds a little bit weird, I would rather configure JMeter to behave exactly like a real user which is using real browser including "times to think" between operations and manipulate only number of threads - this way I would be able to state that the system supports X concurrent users without issues.

More information: What is the Relationship Between Users and Hits Per Second?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...