How SpaceGlasses Builds the Future with Heroku
September 19, 2013 by Sara Dornsife
Editor's note: This is a guest post from Michael Buckbee of Meta/SpaceGlasses.
SpaceGlasses are augmented reality glasses that actually work. They let people control systems with a gesture, see virtual objects on top of the real world and create technology that would make Tony Stark proud.
Prior to joining Meta, I had developed and managed a number of high traffic Rails sites. I was brought on to help move the company’s website from a single static launch page to being an e-commerce platform and to help lay the groundwork for the company’s app store.
We chose to build on top of Heroku as we are moving very quickly, need to have a lots of flexibility and don’t have the time or budget to provision our own infrastructure from scratch.
As the site’s traffic has rapidly grown from tens of thousands to hundreds of thousands of visitors a day being on Heroku has only made more sense.
Beyond just manually tweaking the number of web dynos that were running we were able to take advantage of a number of other Heroku add-ons and services to great effect:
1. Memcache as a Service
One of the first steps we took was to start caching everything possible in Memcached, facilitated by the Memcachier Add-on. We started by using Rails built in Action Caching to reduce the load that underlying Unicorn servers running inside the dynos needed to function. On several pages with heavy database interaction results were cached separately. However, one of the somewhat biggest wins for us was using Memcached as a buffer to keep near real time order information from our e-commerce provider readily available.
2. Sysadmin in a Box
Being the sole full time web-developer on the project (all the other software and electrical engineers are working feverishly making the actual glasses), it was tremendously valuable for us to be able to scale at whim. While I certainly could have taken the time to setup HAProxy and SSL, and a series of AppServers and Postgres, having Heroku available was like having an on-demand sysadmin available 24 hours a day.
3. Scaling as a Service
Early on, we had added the AdeptScale service to our production Heroku stack. AdeptScale dynamically increases the number of running web dynos in relation to response time metrics.
If response times increase, more and more dynos are added. We continuously monitor the site and were surprised one day to find that 30 dynos had been spun up.
Turning to Google Analytics we were a little flabbergasted to realize that we had climbed up to comfortably handling 3000 active visitors to the site without even realizing it.
Some investigation turned up that we had become a major topic of conversation on 4Chan that day. The 120,000 visitors that came to the site over the next 24 hours from 4Chan were a mix of the genuinely curious, aggressively hostile and quite a few with a real vision of the future. All of which we sailed through because of AdeptScale and Heroku.
Building The Future
Heroku has been a lifesaver in allowing us to book hundreds of thousands of dollars of sales we would have otherwise lost out on due to downtime. As we start launching new services and products it’s a huge comfort to know we just don’t have to worry about our hosting or our ability to handle the future.