Home » Web Applications, Website Design » How to increase the speed of your website by large margins

How to increase the speed of your website by large margins

Lately I have been doing alot of research on how to make an exceedingly fast website. So in order to accomplish such a task I had to identify all the components I use when making a website and what they depend on. So let’s do a break down of the components you use when developing a website:

  • Programming Languages – PHP, Java, Perl, Python, C#, C++, Ruby, etc

  • Browser – Safari, Firefox, Chrome, Internet Explorer (this browser is not worth mentioning but it is popular so it shall remain) client technologies are HTML, Javascript, CSS and Images (Not a client technology but is loaded by the browser)

  • Database – MySQL, Oracle, Microsoft SQL Server

  • Hardware – CPU, Ram, Hard Drive

Programming Languages

This has always been a common debate amongst programmers, what is the fastest programming language? I have heard and heard this time and time again and when I hear the debate it’s something that can be easily SQUASHED! You have two different types of programming languages. You have compiled and interpreted languages. Compiled programming languages (C++) are faster than Interpreted languages (PHP, Python) period. The reason why is because compiled languages go from source code to machine code which is what the computer understands. Interpreted languages have to be read by an interpreter and than changed into machine code on the fly every time it is executed. Better example is imagine a compiled language as a person who speaks English and the interpreted language as a person who speaks Spanish and the computer is a person that speaks English. When the compiled language speaks to the computer it already speaks English helping the computer quickly understand what it is saying. With the interpreter you have to have a person who is the translator aka interpreter to translate the Spanish to English so to the computer can understand. So hopefully at this point you can determine who is faster. COMPILED LANGUAGES!!!

You may ask why do people use interpreted languages instead of compiled languages? Mostly because they make it easier to accomplish complex tasks with less code base on them being created at later times than compiled languages and being made to accomplish more modern tasks with website design. Still there are ways to still use interpreted languages and get around the speed issues. Facebook has came up with an interesting solution. Facebook uses php to fun their famous web application but in order to speed up there website and use less resources they created something called hip hop php. Hip hop php translates php into a compiled language. By doing this Facebook has nearly doubled their performance gains. Python even have frameworks that when started by the server changes the python into a compiled version of the original code creating a faster version of the website.

Browser

Well you may be asking yourself why is he bringing up about the browser since we can’t control what browser the user is using. As true as this is we can control what code the browser sees. The browser interprets HTML, CSS, Javascript and Images from the web server and loads it for your eyes to see. Now the question is how can we speed this up? Well one word compression. For HTML, CSS and Javascript you can use gzip compression. Gzip compression works by finding similar strings within a text file, and replacing those strings temporarily to make the overall file size smaller. This form of compression is particularly well-suited for the web because HTML and CSS files usually contain plenty of repeated strings, such as whitespace, tags, and style definitions. It works by first checking to see if the browser supports gzip encoding. If the browser approves it will send a compressed version of the web page to the browser to interpret it. Here is a better example here if you like pictures. It’s pretty easy to use, just check and see if your programming language supports it and than implement accordingly.

Another type of compression you can also do that works whether the browser needs to approve it or not is minifying your css or javascript files. Just like Gzip compression but eliminates spaces, tags and style definitions within the file so if a request is sent over the internet your browser can download it quicker without any type of approval process and regardless of how old your browser might be. Yahoo has developed program to minify your files here. Jquery uses the same method for their files also. They mention it here

Images are probably one of the main things that take the most time when downloading a website. Especially with newer and newer cameras coming with bigger mega pixels. Usually after you take a picture on today’s camera it will be usually over 1 megabytes which is way too big for a website. So what you do, you guessed it right you need to compress it. My favorite method for compressing files is using photoshop save for web function and resizing the images can reduce the size of a image that is 2.0 megabytes to under 50 kilobytes or less. Another option if you do not wish to buy photoshop for several hundred dollars (understandable) you can use an online program called Image Optimizer. There are other alternatives out there but I have tested them.

Databases

With databases I have tested and played around with such as MySQL, Oracle, SQLite run pretty good considering how optimized the query is and how many results you are fetching. Also it depends on the hardware (read the hardware recommendations) and if it is a 32 or 64 bit version. If you read one of my earlier articles you see that 64 bit is faster than 32 bit versions. But in order to use 64 bit programs you have to first have 64 bit operating system which is offered by every known manufacturer nowadays. I will even recommend that you always get the 64 bit version if it is available, unless it is unstable or not in its final version.

Hardware

This is probably the MOST important aspect with the speed of your website. Programming languages, databases, every thing software related depends on hardware. Even though every thing depends on the hardware you need to know what aspects of the hardware correlate to the software. Since we are talking about the speed of the website the most essential thing with speed of the CPU. The faster the CPU the faster your programming languages, databases run. I would suggest a CPU that has multiple cores.

The next thing is memory, memory can run out pretty fast on high end systems. With hard drives I really like solid state hard drives but they are really expensive for the size you might want. They are the fastest drives on the market right now and you will definitely will see the increase in speed. I would personally suggest getting sata 3.0 drives and sticking with that until the price of regular hard drives drop, because you probably be making several backups of your site and database.

Another aspect of memory to remember is Ram. With the server, database and website running ram can get used up pretty fast but it always depends on what you are doing. If you are just experimenting you really don’t have much too much to worry about but if you are running something the whole world is going see I suggest getting ram that is pretty fast and over 4 gigabytes of memory. Also remember there will be several other applications and plug-ins that you might install to complement your website so we didn’t even factor this into the equation yet but that can vary greatly. Other than that have fun! Feel free to leave any questions or comments.

Popularity: 1% [?]

Random Posts

1 Comment

  1. Thank you for your share. It’s worth to read.

Leave a Reply

Copyright © 2010 · Comp Sci Solutions · All Rights Reserved · Posts · Comments