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 ! :injured:

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?!

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?

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

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 (since they are on the same machine)?

Please note, don’t point your domain name to 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 (unless you need outside resources hitting it). If you need outside resources hitting it, using localhost to connect to your database.

its set to localhost

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

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.

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=

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/

I think I understand how this works I ran:

[root@srv1 ~]# mysqldumpslow /var/log/mysql-slow.log
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

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?

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. :eek: 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.

Hehe, I think you missed a post or two :slight_smile: He found the bulk of his time due to an XML file, once that was removed, it dropped to a 1 second load time :slight_smile: 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).

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.

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

hmm the 50+ request is new for me, Ill look into this.

The upgrade looks pretty straight-forward…