Entries Tagged as 'server'

Mysql on Windows vs Linux

I was working on optimizing a Mysql database today and accidentally stumbled upon a benchmarking exercise. The original Mysql database is hosted on a Windows Server 2003. I develop on a Mysql database server running on Ubuntu Linux. The Linux server ran the same query twice as fast as the Windows server without using caching or anything. I know that Linux does I/O caching on its own as well so I even tried running the query after a fresh reboot to rule out that factor. Then I got help from a colleague and started tweaking with the my.cnf/my.ini to make sure they were the same and each time, the results came back about the same. Mysql on Windows was consistently slower than Mysql on Linux.

Then we decided to load the database onto other servers for more data points on this Mysql performance test. We ran the same query returning 429 rows of data with 13 table joins and a couple of sub-queries. All queries were run on the command line client on the servers themselves to avoid network lag.  All servers are running Mysql 5.0.x.

Results

1. Ubuntu Linux: 0.70 seconds
2. CentOS: 0.78 seconds
3. Windows 2003 Server: 1.40 seconds
4. Windows 2003 Server: 1.42 seconds

Server hardware

1. Ubuntu Linux
AMD ATHLON 64 X2 4200+
2GB DDR400
200GB 7200RPM SATA/150

2. CentOS
Dual Opteron 240
2GB DDR ECC
120GB 7200RPM SATA/300

3. Windows 2003 Server
Dual Xeon
2GB DDR ECC
7200RPM PATA

4. Windows 2003 Server
2 Dual Xeon (4 CPUs)
8GB DDR ECC
3 73GB 10,000RPM SCSI in RAID 5

In House Hosting vs ISP

Clients are always trying to determine if they should host their own site in house or using an ISP. While in the past I would definitely suggest using an ISP, it is not so cut and dry as the cost of servers and bandwidth have decreased dramatically. These days, I can build a server that is super fast for around $1,000. Getting a DSL line with static IP addresses cost around $75 per month. It allows for ease of system upgrade and for more advanced integration into business systems through programming. While there is the down side of power backup issues and hardware failures to contend with, it is still a viable option if the website is not a mission critical application.

Speed Matters

It has been said many times by many people, but I have to reiterate again how important it is to have a website that loads quickly.  Researches have shown that visitors to a page has the patience to wait only four seconds before hitting the Back or Esc button and off they go.  However, I have encountered so many content rich sights that take well over that before the page is loaded with content I am interested in.  Some sites just do not have anything showing before the page is up, others will have random images appearing and pushed into place as more are loaded, but the content is no where to be seen.

So what can you speed up the load time for your site.  For one thing, if you are using more advanced technology than static HTML files, which most site are in this category these days, you need to make sure the server hosting the site is fast enough.  A lot of sites are running on the cheapest shared web hosting services and as we all know, the cheapest is not always the best.  These services do give you a lot on paper, but with their bogged down servers you will never be able to utilize half the resources they allow for your account.

Now, if your hosting service or your own server is plenty fast with enough bandwidth, then it is time to look closer at the details.  Like I mentioned before, if you are running a static HTML site, these tips will not help you.  But you do have many other problems of how on earth will you update your content or design across the entire website.  That is another post.  But for the majority of us using databases to generate dynamic content, the database is a big culprit in site latency.  Databases need to be optimized for the hardware and the application it is running.  Optimizing a database starts from the design of the schema to the implementation of regular maintenance processes.  Again, there can be books written on how to optimize a database and maybe I will write one someday.

Anyhow, if you are running a site that is slow, don’t just ignore it.  Spend some time to figure out why it is slow and solve the issue.  It would be a shame to lose all those potential visitors to slow load time.

Apache SSL IfDefine - Error

Just encountered a problem that was painful to deal with while configuring SSL on apache for linux.  The httpd.conf had a tag, , before all the SSL configuration lines.  In order for any commands within and to be loaded on service start, you must use the -D attribute like this.

$ service httpd -D SSL -k start

Also, I found that restart does not always take new changes to my conf files.

$ service httpd -D SSL -k restart

Instead, use the stop then the start command to be sure.

$service httpd -D SSL -k stop
$service httpd -D SSL -k start

That was a source of much pain while working on this particular server.