Skip to main content

From Coding Websites to Managing Servers

By October 15, 2013October 17th, 2013Computer Science

This past summer, I started working at a startup company called Olaunch. When I first began, I started a project on building a new CMS using PHP5 and I stumbled on learning how to create websites.

I’ve used PHP before when I was in high school, but back then there weren’t many ways for me to create and build a website since resources were very vague for someone with no prior knowledge on how to do any coding. Luckily I did dabble in reading some PHP code to understand it all thanks to Invision Board before they removed their free versions and then I moved onto PHP-Nuke.

But a lot has changed since then and I barely knew how to do anything so I started on learning how to use the Yii framework. This project on building went on for the entire summer but I never got to finish because there was always something that I needed to learn whether it was Bootstrap, Javascript, JQuery, or APIs from other services.

Speaking of APIs, I actually learned how APIs worked especially when I attended the Hollywood Hackathon. I had no prior major experience in coding but it did show me how valuable coders were cause a majority of people were those that had ideas but didn’t know how to code at all. From there, I basically realized APIs will take over most construction of products in the future. By reducing functions to the barebones for everyone to be able to utilize. This article on GigaOM outlines what I believe will happen in the future, although the hardware side of me believes that the inefficiencies of API services need to be addressed with optimizing hardware or what Facebook is doing with their Open Compute Project.

Moving beyond this, towards the end of the summer the startup began on a launch of a new site but problems began to start because we had no idea how to optimize servers. We were using WordPress installations on the standard Apache with PHP5 and MySQL in a vps server but I began to read and implement changes that would help optimize the backend of the server. This began the long and tedious of learning how to install and compile linux packages, along with editing files and using command line for everything. First thing I did was build a Percona MySQL Cluster using this guide which is kind of dated for seven month changes but still usable. The next step I did was migrate all websites into a server setup that I thought would be best:

  • Nginx 1.5.5 with SPDY and Cache Purging Support (I should update them to 1.5.6 soon)
  • PHP-FPM 5.4.20
  • XCache 3.0.3
  • OptiPNG 0.7.4
  • Xdebug (I disabled this plugin because of New Relic)
  • New Relic

From then on, I used this setup for each and every server on DigitalOcean for Olaunch’s websites which saved alot more money than previously hosting them on Rackspace. This resulted in the current setup shown below here:

 Cloudflare handles all the front-end requests by users to reduce the load on static files on the servers. The purple tubes each represent a VPS server dedicated to only Nginx and PHP-FPM with the exception of the last one which also has a Haproxy server for MySQL. The MySQL servers are all synced to each other by Percona’s MySQL Cluster and all the MySQL requests are pushed towards a Haproxy server that distributes all the requests by a round robin pattern.

Most of the installations were WordPress Installations which I tried to find ways to improve the Google PageSpeed scores and YSlow grades. OptiPNG along with jpegoptim were one of several apps I used reduce image sizes on the servers and I personally went through almost each and every javascript and cascading style sheet file to minify. This shows one of my biggest addictions :”Optimization” ( Which I’ve gone crazy over without stopping until believe I can’t do anything much further. I will later put up how I optimized my SHA1 Verilog Project for a Electrical Engineering Class and scored the best results when I’m finished.)

If you have noticed, I’m also using the MySQL servers for my own websites but with a VPS server hosted on RamNode. I have personally been using RamNode for a while and decided to start my own personal server to test delay and so far it seems negligible for the time being. I do plenty of implementation and testing in my spare time and one of the things I plan to do is migrate some of the Digital Ocean servers over to RamNode because I want to spread out servers for greater flexibility in the future.

In the future I plan to make guides to show how to create this configuration in my spare time.

%d bloggers like this: