SitePoint Sponsor

User Tag List

Page 1 of 2 12 LastLast
Results 1 to 25 of 44
  1. #1
    SitePoint Enthusiast ICTaanbieding's Avatar
    Join Date
    Jan 2014
    Location
    Vlaardingen, The Netherlands
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    VPS on CentOS extremly slow webserver

    I got a VPS with the following specs:
    CPU: 4 cores
    RAM: 8192 MB
    Harddisk: 300 GB

    I got direct admin installed on it (VPS Came with it) and I uploaded a site to it .. so far so good!

    now the problem im facing is that the webserver is extremly slow, The website takes ages to load (www.ictaanbieding.nl)
    I tested it on http://www.webpagetest.org and Everything seems fine exept for First Byte Time

    I have no idea what to do here, I hope you guys can help me out !

  2. #2
    Hosting Team Leader silver trophybronze trophy
    cpradio's Avatar
    Join Date
    Jun 2002
    Location
    Ohio
    Posts
    5,118
    Mentioned
    152 Post(s)
    Tagged
    0 Thread(s)
    First thing I'd personally do, is rule out any programming. Place a static simple page as your index.html or whatever your default loading page is, and run your test again. If it still takes forever and a day, then you know it is a network/server setup issue. If it takes a split second and gives you an A, then you know you need to look internally at the application/program that runs your site. Maybe it is your database connection (for example), or a poorly written section of code.

  3. #3
    SitePoint Enthusiast ICTaanbieding's Avatar
    Join Date
    Jan 2014
    Location
    Vlaardingen, The Netherlands
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by cpradio View Post
    First thing I'd personally do, is rule out any programming. Place a static simple page as your index.html or whatever your default loading page is, and run your test again. If it still takes forever and a day, then you know it is a network/server setup issue. If it takes a split second and gives you an A, then you know you need to look internally at the application/program that runs your site. Maybe it is your database connection (for example), or a poorly written section of code.
    Damn, yes ofc thats a good way to test it, tested this, added a simple test index.html and no delay at all. ran the test again and it got an A
    Its a start but whats next?!

  4. #4
    Hosting Team Leader silver trophybronze trophy
    cpradio's Avatar
    Join Date
    Jun 2002
    Location
    Ohio
    Posts
    5,118
    Mentioned
    152 Post(s)
    Tagged
    0 Thread(s)
    So now you know it isn't the server setup/configuration, but now something that is internal.

    Is your database and apache setup on the same VPS or are they separate entities?

  5. #5
    SitePoint Enthusiast ICTaanbieding's Avatar
    Join Date
    Jan 2014
    Location
    Vlaardingen, The Netherlands
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    both on the same VPS,

    Im running a simple opencart webshop with 8000 products, and all of them got a image (I thought that might be the issue) but even with image compression its slow

  6. #6
    Hosting Team Leader silver trophybronze trophy
    cpradio's Avatar
    Join Date
    Jun 2002
    Location
    Ohio
    Posts
    5,118
    Mentioned
    152 Post(s)
    Tagged
    0 Thread(s)
    Are you using localhost as your connection string for your database? Or are you using a DNS entry? If a DNS entry, do you have a entry in your /etc/hosts file that indicates the DNS entry should be pointed to 127.0.0.1 (since they are on the same machine)?

    Please note, don't point your domain name to 127.0.0.1 unless you want your site to be unreachable. If you are using mysql.domainname.com then I'd have that in your /etc/hosts file pointing to 127.0.0.1 (unless you need outside resources hitting it). If you need outside resources hitting it, using localhost to connect to your database.

  7. #7
    SitePoint Enthusiast ICTaanbieding's Avatar
    Join Date
    Jan 2014
    Location
    Vlaardingen, The Netherlands
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    its set to localhost

    edit: would there be a benefit to point it to a dns ?

  8. #8
    Hosting Team Leader silver trophybronze trophy
    cpradio's Avatar
    Join Date
    Jun 2002
    Location
    Ohio
    Posts
    5,118
    Mentioned
    152 Post(s)
    Tagged
    0 Thread(s)
    okay, now to start to rule out your opencart queries.
    I'd ensure slow_query_log is enabled, access your homepage and then execute mysqldumpslow to review if any of the queries are not performing very well.

    If that all looks good, I'd turn my attention to any third party sites your site may be accessing, as they may be slowing it down.

  9. #9
    SitePoint Enthusiast ICTaanbieding's Avatar
    Join Date
    Jan 2014
    Location
    Vlaardingen, The Netherlands
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    slow_query_log is enabled, the logfile is empty, I dont understand how to execute mysqldumpslow to review it

    When I try this in putty I get: (just by giving the command: mysqldumpslow
    Can't determine basedir from 'my_print_defaults mysqld' output: --bind-address=127.0.0.1

    When I use the command: mysqldumpslow /home/admin/domains/ictaanbieding.nl/public_html
    Its telling me its reading mysql slow query log from /home/admin/domains/ictaanbieding.nl/public_html

    again no output in te mysql-slow.log file I created in /var/log/

  10. #10
    SitePoint Enthusiast ICTaanbieding's Avatar
    Join Date
    Jan 2014
    Location
    Vlaardingen, The Netherlands
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think I understand how this works I ran:


    [root@srv1 ~]# mysqldumpslow /var/log/mysql-slow.log
    Output:
    Reading mysql slow query log from /var/log/mysql-slow.log
    Count: 1 Time=0.00s (0s) Lock=0.00s (0s) Rows=0.0 (0), 0users@0hosts

  11. #11
    SitePoint Enthusiast ICTaanbieding's Avatar
    Join Date
    Jan 2014
    Location
    Vlaardingen, The Netherlands
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I fixed it or atleast made it load a lot faster (it was 20 seconds) its 1.834s now wich is still a big F
    Found a xml file, made a backup of it and deleted it as it wasnt a original opencart file. after this it speeded up!

  12. #12
    Hosting Team Leader silver trophybronze trophy
    cpradio's Avatar
    Join Date
    Jun 2002
    Location
    Ohio
    Posts
    5,118
    Mentioned
    152 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by ICTaanbieding View Post
    I fixed it or atleast made it load a lot faster (it was 20 seconds) its 1.834s now wich is still a big F
    Found a xml file, made a backup of it and deleted it as it wasnt a original opencart file. after this it speeded up!
    Interesting... was the XML file being read by opencart?

  13. #13
    SitePoint Wizard
    Join Date
    Oct 2005
    Posts
    1,832
    Mentioned
    5 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by ICTaanbieding View Post
    but even with image compression its slow
    Image compression? Images are already compressed. You are not attempting to compress them again, are you? I didn't see any evidence of that, but I have to ask.

    Your main page has 50 requests. That is a lot, but not the root of the problem. tools.pingdom.com indicates the wait time to receive the HTML of your index page is over 20 seconds. That's some of the worst performance I have ever seen outside of a shared host I used years ago. On the first load, all of your files took a long time to be transmitted, including the images, CSS, and JS. On secondary loads, the HTML still took over 20 seconds to be received but the linked in files took less time. That seems to indicate the bottleneck is in the page generation somewhere.

    Are you running any type of PHP accelerator? It looks like you are using PHP 5.3 which was released in 2009 and for which support will end in July 2014. You should consider upgrading to PHP 5.5 if your code will allow it. Significant improvements in performance have been made since 5.3. Plus, 5.5 has an available opcode cache that can help improve performance. But I don't think that will help in your situation.

    For now you must simplify. Turn off output compression for starters and any other special, non-essential configuration features. If that doesn't help, you will have to start profiling your code and database queries to find where the trouble is. You have a powerful VPS. No way should it take this long to load a page.

    Right after I posted this I saw the original poster's reply and tested his site again. The main HTML load time has declined from 20 seconds down to 0.723 seconds. I think the OP fixed it.

  14. #14
    Hosting Team Leader silver trophybronze trophy
    cpradio's Avatar
    Join Date
    Jun 2002
    Location
    Ohio
    Posts
    5,118
    Mentioned
    152 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by cheesedude View Post
    Your main page has 50 requests. That is a lot, but not the root of the problem. tools.pingdom.com indicates the wait time to receive the HTML of your index page is over 20 seconds. That's some of the worst performance I have ever seen outside of a shared host I used years ago. On the first load, all of your files took a long time to be transmitted, including the images, CSS, and JS. On secondary loads, the HTML still took over 20 seconds to be received but the linked in files took less time. That seems to indicate the bottleneck is in the page generation somewhere.
    Hehe, I think you missed a post or two He found the bulk of his time due to an XML file, once that was removed, it dropped to a 1 second load time However, there is still the 50+ requests being loaded, and that may be the issue at hand now. There is also the 404 on the favicon.ico that will add time as well. Just create a blank favicon.ico (if you don't have one already, so you can get rid of the 404).

  15. #15
    SitePoint Enthusiast ICTaanbieding's Avatar
    Join Date
    Jan 2014
    Location
    Vlaardingen, The Netherlands
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes it was doing something with my images, and I got 10K images so I think that just caused it to overload.
    its fixed now, so thats great haha thanks for your help!

  16. #16
    SitePoint Wizard
    Join Date
    Oct 2005
    Posts
    1,832
    Mentioned
    5 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by ICTaanbieding View Post
    Yes it was doing something with my images, and I got 10K images so I think that just caused it to overload.
    its fixed now, so thats great haha thanks for your help!
    You should still consider upgrading from PHP 5.3.

  17. #17
    Hosting Team Leader silver trophybronze trophy
    cpradio's Avatar
    Join Date
    Jun 2002
    Location
    Ohio
    Posts
    5,118
    Mentioned
    152 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by cheesedude View Post
    You should still consider upgrading from PHP 5.3.
    I'll second that. I don't think it will make a huge difference in the loading of your site, but you'll be better protected from known vulnerabilities.

  18. #18
    SitePoint Enthusiast ICTaanbieding's Avatar
    Join Date
    Jan 2014
    Location
    Vlaardingen, The Netherlands
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by cpradio View Post
    I'll second that. I don't think it will make a huge difference in the loading of your site, but you'll be better protected from known vulnerabilities.
    true but tbh im a bit scared to upgrade, Im not that experienced and dont wanna mess things up haha.
    if I email you root details will ya do it ? haha

    Im not sure if Opencart supports php 5.5.1

  19. #19
    SitePoint Enthusiast ICTaanbieding's Avatar
    Join Date
    Jan 2014
    Location
    Vlaardingen, The Netherlands
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hmm the 50+ request is new for me, Ill look into this.

  20. #20

  21. #21
    Hosting Team Leader silver trophybronze trophy
    cpradio's Avatar
    Join Date
    Jun 2002
    Location
    Ohio
    Posts
    5,118
    Mentioned
    152 Post(s)
    Tagged
    0 Thread(s)
    Also your host may do it for you for a nominal fee (depending on the type of VPS service you signed up for)

  22. #22
    SitePoint Enthusiast ICTaanbieding's Avatar
    Join Date
    Jan 2014
    Location
    Vlaardingen, The Netherlands
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hmm I tried, but its telling me no package available.. weird


    [root@srv1 ~]# rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm
    Retrieving http://mirror.webtatic.com/yum/el6/latest.rpm
    Preparing... ########################################### [100%]
    package webtatic-release-6-4.noarch is already installed
    [root@srv1 ~]# yum install php55w php55w-opcache
    Loaded plugins: fastestmirror, presto, replace, security
    Loading mirror speeds from cached hostfile
    * base: centos.mirror.triple-it.nl
    * extras: centos.mirror.triple-it.nl
    * updates: centos.mirror.triple-it.nl
    * webtatic: nl.repo.webtatic.com
    Setting up Install Process
    No package php55w available.
    No package php55w-opcache available.

  23. #23
    SitePoint Enthusiast ICTaanbieding's Avatar
    Join Date
    Jan 2014
    Location
    Vlaardingen, The Netherlands
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    the website is back to being very slow, so I guess it wasnt the xml file but deleting those was just coincidence.
    I did however find the reason ( I think)

    In my direct admin I had 42 messages (started this server sunday) telling me there was a brute force attack:
    A brute force attack has been detected in one of your service logs.

    User root has 2978 failed login attempts: proftpd1=4&sshd5=2974

    Check 'Admin Level -> Brute Force Monitor' for more information
    http://help.directadmin.com/item.php?id=404

    with a shitload of logs like this one:

    13897348210015 61.147.107.99 root 1 sshd5 Jan 14 22:26:44 srv1 sshd[5979]: Failed password for root from 61.147.107.99 port 4894 ssh2
    13897348210014 61.147.107.99 root 1 sshd5 Jan 14 22:26:42 srv1 sshd[5979]: Failed password for root from 61.147.107.99 port 4894 ssh2
    13897348210013 61.147.107.99 root 1 sshd5 Jan 14 22:26:40 srv1 sshd[5979]: Failed password for root from 61.147.107.99 port 4894 ssh2
    13897348210012 61.147.107.99 root 1 sshd5 Jan 14 22:26:37 srv1 sshd[5979]: Failed password for root from 61.147.107.99 port 4894 ssh2
    13897348210011 61.147.107.99 root 1 sshd5 Jan 14 22:26:35 srv1 sshd[5979]: Failed password for root from 61.147.107.99 port 4894 ssh2
    13897348210010 61.147.107.99 root 1 sshd5 Jan 14 22:26:29 srv1 sshd[5977]: Failed password for root from 61.147.107.99 port 4423 ssh2

    any way I can stop this ?

  24. #24
    Hosting Team Leader silver trophybronze trophy
    cpradio's Avatar
    Join Date
    Jun 2002
    Location
    Ohio
    Posts
    5,118
    Mentioned
    152 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by ICTaanbieding View Post
    the website is back to being very slow, so I guess it wasnt the xml file but deleting those was just coincidence.
    I did however find the reason ( I think)

    In my direct admin I had 42 messages (started this server sunday) telling me there was a brute force attack:
    A brute force attack has been detected in one of your service logs.

    User root has 2978 failed login attempts: proftpd1=4&sshd5=2974

    Check 'Admin Level -> Brute Force Monitor' for more information
    http://help.directadmin.com/item.php?id=404

    with a shitload of logs like this one:

    13897348210015 61.147.107.99 root 1 sshd5 Jan 14 22:26:44 srv1 sshd[5979]: Failed password for root from 61.147.107.99 port 4894 ssh2
    13897348210014 61.147.107.99 root 1 sshd5 Jan 14 22:26:42 srv1 sshd[5979]: Failed password for root from 61.147.107.99 port 4894 ssh2
    13897348210013 61.147.107.99 root 1 sshd5 Jan 14 22:26:40 srv1 sshd[5979]: Failed password for root from 61.147.107.99 port 4894 ssh2
    13897348210012 61.147.107.99 root 1 sshd5 Jan 14 22:26:37 srv1 sshd[5979]: Failed password for root from 61.147.107.99 port 4894 ssh2
    13897348210011 61.147.107.99 root 1 sshd5 Jan 14 22:26:35 srv1 sshd[5979]: Failed password for root from 61.147.107.99 port 4894 ssh2
    13897348210010 61.147.107.99 root 1 sshd5 Jan 14 22:26:29 srv1 sshd[5977]: Failed password for root from 61.147.107.99 port 4423 ssh2

    any way I can stop this ?
    Yes, and I'm not the best resource for that, but iptables and blocking the IP would be my first thought.
    Also, make sure you have a VERY strong password and if you are comfortable with Putty/Shell, use a public/private key with a passphrase

    Calling the Hosting Team (to the rescue!): @ScallioXTX ; @EastCoast ; @Force Flow ;

  25. #25
    SitePoint Enthusiast ICTaanbieding's Avatar
    Join Date
    Jan 2014
    Location
    Vlaardingen, The Netherlands
    Posts
    25
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by cpradio View Post
    Yes, and I'm not the best resource for that, but iptables and blocking the IP would be my first thought.
    Also, make sure you have a VERY strong password and if you are comfortable with Putty/Shell, use a public/private key with a passphrase

    Calling the Hosting Team (to the rescue!): @ScallioXTX ; @EastCoast ; @Force Flow ;
    yea but they change IP every 10 seconds or so, so thats hard to block. I could block All exept for my wn If i knew how to haha


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •