Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


What exactly bottlenecking my VPS ?
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

What exactly bottlenecking my VPS ?

FIrst thing first. I am using vestacp, I don't know if it matters or not.

I am using adminer to import a database (about 25.000 rows). The thing is, before the database import is completed, I can not visit or interact with my website. **However ** the website on other users just fine.

I can visit my control panel just fine, i can visit phpmyadmin, i can visit another user websites just fine. The only thing that seemingly to be blocked is the website that I use to import database.

And how does it work anyway ? if it's a matter of lack of resource (I am pretty sure it's not, based on my server monitor), why it's only affecting one user ? I want to be able to use 100% of my resource, even if it means bring the entire vps down.

Comments

  • mkshmksh Member

    How is your webserver setup? Php-fpm with per user pools maybe that are somehow limited (pool config, cgroups, ...)? Besides what do you mean by not visit or interact? Connection times out? Connection rejected? Script refusing to work because DB import is not complete yet?

  • @mksh said:
    How is your webserver setup? Php-fpm with per user pools maybe that are somehow limited (pool config, cgroups, ...)? Besides what do you mean by not visit or interact? Connection times out? Connection rejected? Script refusing to work because DB import is not complete yet?

    Apache + Nginx + PHP. Default vestacp setup.

    It tooks a very long time time to load and throw error 500 with 504 Gateway timeout.

  • Any error log?

  • mkshmksh Member

    @yokowasis said:
    Apache + Nginx + PHP. Default vestacp setup.

    Sorry, i have no idea how a default setup of vestacp looks like. Anyways, is that nginx running as reverse proxy in front of apache? Which one of these is responsible for handling PHP?

    It tooks a very long time time to load and throw error 500 with 504 Gateway timeout.

    So you randomly get either a 500 or a 504 error?

    Sorry, you either need to find someone who knows this exact problem with vestacp or describe your setup in detail otherwise it's almost impossible to isolate what's likely to cause the behaivour you are seeing.

  • @mksh said:

    @yokowasis said:
    Apache + Nginx + PHP. Default vestacp setup.

    Sorry, i have no idea how a default setup of vestacp looks like. Anyways, is that nginx running as reverse proxy in front of apache? Which one of these is responsible for handling PHP?

    Yes, Nginx as Reverse Proxy. Apache handling the PHP execution.

    It tooks a very long time time to load and throw error 500 with 504 Gateway timeout.

    So you randomly get either a 500 or a 504 error?

    Sorry, you either need to find someone who knows this exact problem with vestacp or describe your setup in detail otherwise it's almost impossible to isolate what's likely to cause the behaivour you are seeing.

    No, the screen showing 500 internal server error, but the log on inspect element shows 504 Gateway timeout.

    @robohost said:
    Any error log?

    That's the thing. No error log whatsoever.

  • Try to restart nginx and apache or re import db from comand line

  • WSSWSS Member

    mysql < import.sql

    Thanked by 2vimalware lazyt
  • @robohost said:
    Try to restart nginx and apache or re import db from comand line

    @WSS said:
    mysql < import.sql

    Yeah, I can do that just fine. But the question remain. It's not about how to import database. it's about what caused the lockdown.

  • mysql < import.sql

    This is what you use to save yourself surprises for anything over 100M.

    If you do want adminer and you're using php-fpm, bump up all the relevant memory and uploadsize buffers using php_admin_value= in the adminer site's fpm pool config. (usually placed in /etc/php/7.x/pool.d/ )

    Thanked by 1NanoG6
  • vmp32kvmp32k Member
    edited March 2018

    I have the same (or similar) issue with my self-made nginx + php-fpm setup. When I import or dump anything using phpmyadmin, I have to wait until this one task is done or it loads forever (until it shows a gateway timeout). I assume it's a locking issue either with mysql or php-fpm or php itself.

    WSS said: mysql < import.sql

    That's the proper solution imo.

  • FalzoFalzo Member

    how big is the file you are trying to send/import?
    how fast is your local upload speed?
    is the dump compressed like gz/zip?

    as other pointed out check that memory-limits and timeouts are high enough to deal with the whole process. gateway timeout most likely is just that, you're hitting a timeout for the operation.
    this is single threaded anyway so ofc you have to wait till the whole process of uploading+unpacking+importing is done.

    things have to be written to disk too (hence the question for use of compression) so if your IO is low this might add to the problem. php also adds its overhead especially for large operations, so you'd want to avoid if possible and follow @WSS advice.

    got nothing to do with lack of ressources at all. just lack of patience :-P

    Thanked by 1vimalware
  • WSSWSS Member

    @yokowasis said:

    @robohost said:
    Try to restart nginx and apache or re import db from comand line

    @WSS said:
    mysql < import.sql

    Yeah, I can do that just fine. But the question remain. It's not about how to import database. it's about what caused the lockdown.

    Ignorance and/or stupidity.

    Thanked by 2sibaper kassle
  • @yokowasis said:

    @robohost said:
    Try to restart nginx and apache or re import db from comand line

    @WSS said:
    mysql < import.sql

    Yeah, I can do that just fine. But the question remain. It's not about how to import database. it's about what caused the lockdown.

    then you already know the root cause

  • yokowasis said: Yeah, I can do that just fine. But the question remain. It's not about how to import database. it's about what caused the lockdown.

    Nothing. It's mechanism of mySQL to protect your data.
    While importing data, mySQL will lock down the table to avoid data conflict. This will make the php script wait. But the import progress usually takes more time than PHP's execution time so you will get 500 error.

    Thanked by 2Falzo TheLinuxBug
  • @khuongcomputer said:

    yokowasis said: Yeah, I can do that just fine. But the question remain. It's not about how to import database. it's about what caused the lockdown.

    Nothing. It's mechanism of mySQL to protect your data.
    While importing data, mySQL will lock down the table to avoid data conflict. This will make the php script wait. But the import progress usually takes more time than PHP's execution time so you will get 500 error.

    So, 1 panel user can only do 1 PHP execution ? When 1 visitor , visit the website , the other visitor needs to wait until the first visitor done rendering the website ?

    Is that how it works ?

  • FalzoFalzo Member
    edited March 2018

    @yokowasis said:

    @khuongcomputer said:

    yokowasis said: Yeah, I can do that just fine. But the question remain. It's not about how to import database. it's about what caused the lockdown.

    Nothing. It's mechanism of mySQL to protect your data.
    While importing data, mySQL will lock down the table to avoid data conflict. This will make the php script wait. But the import progress usually takes more time than PHP's execution time so you will get 500 error.

    So, 1 panel user can only do 1 PHP execution ? When 1 visitor , visit the website , the other visitor needs to wait until the first visitor done rendering the website ?

    Is that how it works ?

    that's not what he said. (but he's right anyway ;-))

    Thanked by 1khuongcomputer
  • yokowasis said: So, 1 panel user can only do 1 PHP execution ? When 1 visitor , visit the website , the other visitor needs to wait until the first visitor done rendering the website ?

    Is that how it works ?

    Nope. You can try researching more about mysql table lockdown if you wanna know more about how mysql works.

    In summary, mysql's tables (or rows, if you're using Innodb) like 1 sheet of paper. If someone's writing on it, nobody can read it until he's done.
    But after that, that sheet of paper could be read by many people at the same time.

  • @khuongcomputer said:

    yokowasis said: So, 1 panel user can only do 1 PHP execution ? When 1 visitor , visit the website , the other visitor needs to wait until the first visitor done rendering the website ?

    Is that how it works ?

    Nope. You can try researching more about mysql table lockdown if you wanna know more about how mysql works.

    In summary, mysql's tables (or rows, if you're using Innodb) like 1 sheet of paper. If someone's writing on it, nobody can read it until he's done.
    But after that, that sheet of paper could be read by many people at the same time.

    I am writing a totally different table. The website is a wordpress website. I am not even writing at a wordpress table. Why the user's (only this specific user, other user is totally not affected) website can't be loaded.

    I doubt it was a MySQL lock down.

    Probably some limit that said :
    If this user hasn't finished whatever he executed , he can not execute anything else. Could be php or MySQL. But I think it's PHP. Because the website isn't loaded at all (once again , other users website is totally working just fine).

  • edited March 2018

    yokowasis said: Probably some limit that said : If this user hasn't finished whatever he executed , he can not execute anything else. Could be php or MySQL. But I think it's PHP. Because the website isn't loaded at all (once again , other users website is totally working just fine).

    PHP does have the config that limit a specific number of php instances per user. Maybe it's this case.

  • @khuongcomputer said:

    yokowasis said: Probably some limit that said : If this user hasn't finished whatever he executed , he can not execute anything else. Could be php or MySQL. But I think it's PHP. Because the website isn't loaded at all (once again , other users website is totally working just fine).

    PHP does have the config that limit a specific number of php instances per user. Maybe it's this case.

    What is it named ? it definitely worth a try.

  • Bump,

    Let me rephrase my quesiton.

    I want to make so that, when 1 user doing some intensive works (whatever that case may be), it will use 100% of the server resource available, even if it means, making other users websites down as well. Right now, it seems vestacp, or apache, or php, is limiting one user to specific amount of resource available so they won't disturb another user.

  • vmp32kvmp32k Member
    edited March 2018

    It may be a fundamental issue with PHP and the way the webapp in question handles sessions: https://codingexplained.com/coding/php/solving-concurrent-request-blocking-in-php

    I've setup my server to use memcached for sessions and I'll try and see if that helped at all.

  • @vmp32k said:
    It may be a fundamental issue with PHP and the way the webapp in question handles sessions: https://codingexplained.com/coding/php/solving-concurrent-request-blocking-in-php

    I've setup my server to use memcached for sessions and I'll try and see if that helped at all.

    Thanks. That's some useful tips that makes sense. Will try it out.

Sign In or Register to comment.