Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

AbdulBazith's avatar

My laravel application cant handle 1000 users simultaneously. site cant be reached error when trying to login simultaneously

Guys iam working with laravel project. its a online examination application.

first i have hosted my application in shared hosting. simultaneously 700 students wrote the exam well. past june month full the exam conducted daily. daily 700 students will write exam. everything went fine.

3 days back the school had added further 500 students. now the strength is 1200 students. so we opted to vps server. 4 gb ram and 1 TB hard disk. when all the 1200 students simultaneously tried to login the application yesterday. none of the student cant reach the site.

it showed error

Site cant be reached . 
xyz.com  took too long  to respond
ERR_CONNECTION_TIMED_OUT

so we opted to dedicated server. the configuration is

CPU: Intel Xeon Processor E3-1271 v3 
RAM: 30GB DDR3 RAM 
HDD: 2TB HDDx2 RAID 1 
Bandwidth: 2 TB 

but today student started the same process once again the same problem occured. site cant be reached error.

when i chatted with my support what they said is to optimize the application.

let me explain my configuration first.

my laravel version

Laravel Framework 6.18.0

my project folder inside the server is 150 mb only but images are stored in the storage folder. it takes 600mb (zip format). all the question and answers have example image. so image size is 600mb (in zip state). if i unzip it , then it takes 1 gb above

My DB size image: https://imgur.com/MY84uiV

my db size is : 50 mb with 443231 total rows and 23 tables. and engine is innoDB

What i did to optimize my project is

Route::get('/cc', function () {
    Artisan::call('cache:clear');
    echo '<script>alert("cache clear Success")</script>';
});


Route::get('/ccc', function () {
    Artisan::call('config:cache');
    echo '<script>alert("config cache Success")</script>';
});


Route::get('/vc', function () {
    Artisan::call('view:clear');
    echo '<script>alert("view clear Success")</script>';
});


Route::get('/cr', function () {
    Artisan::call('route:cache');
    echo '<script>alert("route clear Success")</script>';
});


Route::get('/coc', function () {
    Artisan::call('config:clear');
    echo '<script>alert("config clear Success")</script>';
});

Route::get('/storage123', function () {
    Artisan::call('storage:link');
    echo '<script>alert("linked")</script>';
});

so ```xxz.com/cc`` if i give like this cache will be cleared. like that i will give.

other than that i used eloquent queries in all controller. i didnt use any raw queries.

But even in this dedicated server 500 students cant access it why?? is there anything to do.

few of my friends said to change the db engine from innoDB to mariaDB so that it follows many request is that correct?? do i need to do that??

or else do i need to make the login process some what different by sequential request??

but 5 days back in shared hosting 700 students attended the exam well.

iam unable to predict whats happening?? kindly some one help please.

i didnt done any testing.. what kind of testing i should do?? for that testing what should i do?

most of them said to regulate the concurrent user. but how to do that??

my server team said that, the y increased our appache limit to 1000 and execution process to 1000. but these all i didnt do in shared hosting.

i dont know what to do kindly some one suggest all your ideas please.

0 likes
5 replies
martinbean's avatar

@abdulbazith Well you need to find the bottleneck. With that much traffic, I imagine it’s your database. Out of the box, something like MySQL can only handle so many concurrent connections. So look to see if it is indeed the number of allowed connections being exhausted and look to optimise and/or scale your database.

jlrdw's avatar

One option is MS Sqlserver I'm pretty sure it handles more concurrent connections.

Or stagger exam times so you don't have everyone on at the same time.

Or have more than one database set up for exams.

tinfoilman's avatar

I'm guessing that you're server is going to see most of its load for only a fraction of its time running. I would seriously look into going serverless instead of spending the money on a dedicated server that still not be able to keep up with so many sessions hitting at the same time. This is truly when something like Laravel Vapor makes sense.

Even if you don't want to go with Vapor, you can still look into mySQL databases with Amazon Web Services. They'll easily handle your queries and the best part is it won't cost much because it'll be running idle most of the time and you can even turn it off when you're not using it. Even an insane mySQL instance with 96 CPUs and 768GB of memory is only $12/hour. But more likely you could do a 16GB one for just 24 cents an hour!

tinfoilman's avatar

Also, you mentioned that there are a lot of images. I'd definitely serve those from a different server, and ideally some kind of cloud storage. That way your server can put all its resources towards serving pages etc.

AbdulBazith's avatar

@martinbean thank you thank you for your response.

but actually in shared hosting the same worked well for 700 students that make me to doubt, may be due to images this fault occur??

regarding db iam using models only, iam using eloquent queries only. my tables has relationships. beyond that what i should do?

@jlrdw thank you for your response.

can i have more than one database for a single project. can i make relationsip among tables?? but currently now the table has 4 lakh records how i can restructure the table now??

@tinfoilman thank you for your response.

my problem is 1 week back everthing worked fine with shared hosting with just 4 gb ram i think so, and there are 3 lakhs record. 700 students wrote the exam well.

Most of the suggested me to test my project load testing using jmeter. is this correct??

what kind of steps next i need to take??

today what happened is my client said to remove all the images. so i took backup and removed all the images almost 1 gb.

today simultaneously 400-500 students wrote the exam. nothing happened, everthing worked fine. students wrote the exam very well

iam unable to track where the problem is

1)whether its my application 2)whether its my db 3)whether its my server 4)whether its my project size or something else

kindly respond any ideas please.. i need to sort out this problem this week itself..

Please or to participate in this conversation.