Server configuration – script exceptionally doing slow in my server [closed]

I have a high performance PHP script that uses threads and perform a lot of HTTP Post and Database operation per each iterations. I won’t dive into the script code here, caus it’s a simple one, so there’s no need to do so.

I want a server only to run this PHP script and nothing else, so I want all the possible server resources to be available for this script.

The issue:

I’ve tried to run this script in a server (it was tested in servers very similar to mine and it did a great job) with default configuration and I’ve achieved a bad performance (few iterations per second). And the script process just used 5% of CPU and 13% of memory. So, there should be some common bottlenecks, but I have no idea on what and how to avoid them.

As I never set up a server for cases like this before, could anyone please tell me where to begin with it? How would be a common server setup for me?

Edit:

Just got it! (can’t answer my onw question… check my comment bellow) 😀

Answer

Sounds like:

1) The script is not as optimized as you (and others) may think and like to claim (anecdotal evidence aside)

and

2) That you are IO locked either on the remote cURL calls or the hard drive (MySQL writes/reads)

.

Concerning things include:

Most OpenVZ hosts are not built to provide the max resources they advertise. Your host is probably over selling server resources which is compounding your issues. You should look at a different VPS Host Technology, (VMWare, Hyper V, KVM). If you truly NEED maximum performance, I would Look at getting a dedicated server with a SSD (or more in raid), and potentially a move from MySQL to Oracle (but that is a debate for another day).

All in all, Your best bet is a cheap a Dedicated server with:

  1. A high CPU Clock speed (3.0GHz or better)
  2. 1024 MB of RAM Minimum (Depending on how the script operates, throwing more memory at MySQL for caching may provide exponential results)
  3. An upstream internet connection with sufficient dedicated bandwidth for the cURL calls.

It’s quite possible that your OpenVZ Host is IO locked on the HDD. Gaining access to even a dedicated sata drive could net you a 5-7x performance boost.

Also I assume this is a repost:
Server optimization for long running script

Attribution
Source : Link , Question Author : cawecoy , Answer Author : Community

Leave a Comment