Scaling Tech in Asia

15
Scaling Tech in Asia How we scaled Tech in Asia

Transcript of Scaling Tech in Asia

Scaling Tech in AsiaHow we scaled Tech in Asia

About Me

• WordPress Plugins Developer– Since 2003– Created > 22 plugins• wp-pagenavi, wp-polls, wp-postratings, wp-postviews,

wp-dbmanager, etc• http://profiles.wordpress.org/gamerz

• Tech Guy in Tech in Asia– Started officially on 1st September 2014– We are still hiring

Lester Chan (@gamerz) [ 2 ]

Timeline

• July 2014– Willis approached me to join Tech in Asia and

expand the engineering team• August 2014– Hired an awesome engineer, Li Soon– Both of us started work to scale Tech in Asia

Lester Chan (@gamerz) [ 3 ]

Previous Servers

• Previous– Digital Ocean• 1 server• 32 GB/12 CPUS, 320 GB SSD Disk and 7TB transfer• US$320/month• Crashed when we have about 500 users online at the

same time

Lester Chan (@gamerz) [ 4 ]

Lester Chan (@gamerz)

Current Servers

• Current– SoftLayer• Catalyst Startup Program• USD$10,000 credits per month• 5 Bare Metal Servers

– 1x Load Balancer– 3x Web Servers– 2x Database Server– 1x Ops Server

• Highest recorded users online is 2,734

[ 5 ]

Lester Chan (@gamerz)

Monitoring

• Graphite– Push based

• Grafana– Front-end for Graphite

• collectd– data-collecting daemon– network, cpu, load, etc

[ 6 ]

Lester Chan (@gamerz)

User Uploaded Files

• /wp-content/uploads– File uploads are stored here

• GlusterFS– Write once, read everywhere

• Distributed architecture for syncing files• Avoids a single point of failure (i.e. NAS)

[ 7 ]

Lester Chan (@gamerz)

WordPress

• Moved WordPress to a folder /core/– Prevent automated attacks– /core/ is a git checkout of WordPress

• HTTPS– Encrypts sensitive data between computers– Prevents man in the middle attacks– Ranking boost in Google SEO

[ 8 ]

Lester Chan (@gamerz)

Cleaning Up Plugins

• Removed 48 plugins– From 83 plugins to 35 plugins

• Some plugins are poorly coded– No uninstall.php

• Manually removed plugin options from wp_options table

– Remove meta• Comment• Post• User

[ 9 ]

Lester Chan (@gamerz)

CDN

• Previous– EdgeCast• Horrible UI/UX admin interface• No free shared SSL cert

• Current– MaxCDN• Free for us• YC Deal

[ 10 ]

Lester Chan (@gamerz)

Redesigning Theme

• The TiA theme was poorly coded– No proper use of WordPress API– Unnecessary SQL queries all over the place– Not minifying CSS/JS– Unused features still in code

[ 11 ]

Lester Chan (@gamerz)

Redesigning Theme

• Rewrote the theme from scratch– Removed unused or unnecessary features– Use of SVG and Font Icons– Flatter UI– CSS/JS more efficient• Combine + Minify

– Caching

[ 12 ]

Lester Chan (@gamerz)

Web Stack

• Previous– Apache– PHP– MySQL

• Current– nginx– HHVM– MariaDB

[ 13 ]

Lester Chan (@gamerz)

Summary

• Moving Servers• Cleaning up WordPress Plugins• Redesigning theme• Changing our web stack

[ 14 ]

Lester Chan (@gamerz)

Questions?

• Any questions?• You can also find me at– Blog: https://lesterchan.net– Twitter: @gamerz– Facebook: https://fb.com/lesterchan– Instagram: @gamerz

[ 15 ]