A little over a year ago I quitted my day job as a fullstack webdeveloper at a small company in Copenhagen. I did this in order to work fulltime on a startup with two friends of mine.
The startup company (now known as simply “startup”) is doing LIVE events (video recoding and streaming) and hosting the videos/audio clips afterwards, for shareholding companies in Scandinavia.
The project was already running live when I started fulltime on it, as I had started coding on the system about 6 months before in my freetime.
At first we where 2, with a consultant, then we got the last buddy to join and we were 3. We worked from our homes, and used a lot of time doing work, brainstorming and coming up with new things and ways to do the same – only faster, easier and more simple.
We were 3 different people, with different trades and backgrounds:
* One sales person
* One technician
* One developer (me)
We have since grown (by a lot) and are now 6 fulltime workers and 2 student workers. We also lost one of the original partners a few months ago, so a lot changed in the company since we started.
I am still the only developer in the company, and this is where the chain broke for me…
As many people know, working from 8-16 is not a problem. I had recently become a dad, so that life suited me perfectly. But when doing a startup, you are not expected to work only from 8-16 anymore. Time is consumed heavily, and if something crashes, you are expected to fix it right away.
What I learned.
I have spent a lot of time doing Linux server setups. More time than coding i’d say…
I had some experience with Linux servers, but that was in simple environments, with low traffic.
It’s odd that when first starting out, you are “hired” to do coding, but end up fending hacker attacks and handling server stability and server load issues instead.
Before doing the startup, I had mostly worked with PHP and Apache.
I had some experience with Ruby On Rails (rails), which I liked, so I decided to choose this stack for the startup.
Rails helped speeding up the coding – a lot. Of course, rails is a large framework, which has a lot of contraints and rules you have to know and follow – or you will die.
I chose rails for all the gems out there, the community and documentation. I also loved what ruby in general looked like.
That is also what I generally hear about rails: “lots of gems, just pick a lot of those, and you are done!”
But let’s face it, that’s not the whole story. A year into the startup, and I’m using only 10 or 15 different gems (besides the rails ones), 5 of them are dealing with deployments (capistrano)… So i’m using 5-10 gems? not a whole bunch.
Rails have also bitten me in the arse a lot of times. I know that if I was properly schooled in rails, I might not have done a lot of things the way I did it. But that’s just me… “Learn as you go”.
But as rails is as large (and complex) as it is, you cannot just: “Learn and go”.
I have spent a lot of time refactoring code, learning new things, handling odd issues, only to find an odd gem, that handles the exact same thing (which i didn’t know about until later). And why did the rails core team deprecate the ActiveResource lib? It was so easy to use… (I’m using the gem now though)
Scaling rails was easy enough though.
I had a load balancer in front of my servers, which made horizontal scaling easy enough.
However, this wasn’t always enough…
Our systems should be able to handle at least 1000 requests per second, for 1 hour or more in a row (during LIVE events, to listen for changes in the player).
This might not seem like a lot, but if you have a server that can handle a given request in 100ms, that same thread can only handle 10 requests per second.
That meant, that at one time we had 6 servers, serving the same content, and they still couldn’t keep up with the number of requests coming in.
I then started using Redis as a page caching mechanism, and we can now handle around 14000 requests per second (in theory), using only:
1 load balancer
2 redis servers
2.5 web servers
Would I choose rails again for a startup? Properly not… The reason being, that I really don’t use most of the things rails offers, and it’s just so hard to do things differently.
PHP on the other hand, lets you do a lot more. And with composer (e.g. using packagist) being more and more adopted, code snippets are shared more and more.
I’m not saying that PHP is perfect – far from it! But it suits me a lot better.
What I’m taking with me from rails is:
(and a lot more…)
It should be said, that I’m not a big fan of frameworks though. This goes for both Ruby and PHP. I cannot conform and tend to use bits and bites from different frameworks to handle my stuff.
I just quit, now what?
I have just said goodbye to the startup, leaving roughly 18 months of thoughts and code behind.
I am returning to the PHP world, after having left it behind for a long time. And I am actually returning to the same job I had before starting my startup.
This (new/old?) job has other developers and designers, that know what they are doing, which will be nice to get back to.
I feel a lot older and wiser though, having spent time doing all the developing, server handling and project planning myself. I feel like I have a lot more to offer now.
I also think that every developer should try to do a startup. I had often thought about it, but never dared venture into it. It seemed way to risky.
And it is…
You cannot make mistakes, especially if you have something to loose. That being a house, a car… or more importantly: have a family to take care of.
But you somehow grow with the experience… and become better. Perhaps not at coding, but at taking responsibility and at thinking about decisions.
For those interested, this is what I used to develop and design. And the server software.
Software used (on the Mac):
* Firefox Developer Edition
* Google Chrome Canary
* Pixelmator (Graphics app – it’s dirt cheap, and works very well)
* Sequel Pro (SQL app)
* Sublime Text (2+3) (Lots of modules)
* Ubuntu (very easy to use, lots of updated packages etc)
* Nginx, with passenger (played around with puma + nginx in the end as well – just not in production)
* Redis (as a general cache and page cache)
* RVM (very easy when upgrading servers to new ruby versions)
* I also used Nginx as a load balancer, and it works very well.
* The VPS servers are from digitalocean.com (referral link)
Please note: This is not meant as a PHP vs Ruby blog post, but simply my experiences with it.