Last weekend I mentored at Ladies Learning Code - an awesome collaborative environment where, you guessed it, ladies learn to code.
There’s a few reasons why LLC is amazing. Not only for learners, but mentors alike.
You only learn by teaching
I forget the feeling of learning to code for the first time. I also forget the importance of having someone explain things well when learning something new.
Teaching makes you simplify problems and tests your most primitive knowledge. You have only learned something when you can effectively teach it to someone else. Try it.
Collaboration is key
Learning in an environment where team collaboration is encourage is incredible. A great learning experience is when students are teaching other students (see last point). Like most things in life, it’s much easier to work as a team to solve problems. It’s incredible what can come out of a group of individuals who are eager to learn and have a smile on their face.
You meet awesome people
You never know who you are going to meet. LLC brings out some amazing individuals - all with the right moral compass. I met my last business partner at LLC. We sold our business together.
Everyone is doing cool things whether it be working on startups, school or jobs in a totally different sector. Take some time to listen and you will hopefully build some long lasting relationships.
Ladies are smarter than guys
There - I said it, and for one reason - women don’t have egos when learning technical stuff. They don’t think their questions are “stupid” because in reality - they are not. They question the right things and they don’t believe in “computer magic”. When they get things right, they don’t stop there - they want to understand why they were right.
The technology field has largely been driven by men. However, women think differently than men and the shift of women in technology is beneficial to everyone.
Helping feels good
People help people. I have been helped. You have been helped. So, it’s time to give back. It’s fun and it feels good. Talking to a constant LLC contributor, Emma Nemtin about mentoring she says “Volunteering helps you more often than not and it inspires you to keep learning.” I couldn’t agree more.
When I was young, I remember asking my dad - “what is an Entrepreneur?” Quickly, he responded - “it’s someone without a job, son.”
Well, it’s been three months since ‘having a job’ and these are some of the things I’ve learned.
You have a job
Despite what other people want to tell you - you have work to do. You actually DO stuff. You often work a lot. I’d entertain the fact that my hours are more flexible, but just because I’m doing yoga on a Tuesday morning - doesn’t mean I’m not up until 2am on a Thursday - working.
I originally thought that I’d be working every hour of everyday, to ensure success for my company. But, that’s truly not the case. When things need to get done, I ensure that they do - but, taking a break and letting your brain relax is often the best thing for my productivity. It is extremely important that you don’t pretend to work when you are not. It is okay to not be working all the time - in fact, I encourage it. Turns out, when you step away from work you often unconsciously solve problems you have been wrestling with.
You have a boss
It’s you - and that person should be the toughest critic you’ve worked for. It’s not good enough to be just satisfied with something you create. You must be proud of what you do, and you shouldn’t stop until you are. But often, you can’t always be your biggest motivator. Set up goals with your teammates and take time for some constructive criticism along the way. Do things with a purpose and the rest will fall into place.
You have to be creative
You finally get to ‘put your money where your mouth is.’ You have to sharpen your skills and show what you’ve got. Too many times, I said ‘cool’ or ‘motivating’ things in interviews, or with people - but could always fall back on the fact I had a job to tie me up. Now, I have a passion that needs to be relayed in my words and represented in my actions. You don’t get handed the silver platter (or paper plate) very often - so make a meal fit for a king.
You have to make real decisions
Every decision you make is critical. This should not scare you, but encourage you even further. Every decision you make sculpts who you are and what your business is. When you own your own business - each decision means much more. Sculpt with a chisel and not a brush.
You have to enjoy the ride
Sure, there is some stress and a few road bumps along the way - but, it’s important to enjoy the ups and the downs. Yes, enjoy the downs. You learn from the downs and it helps balance the ups. If each day you learn something new, and every day is based on how wise you are - then, every day should get better. It can be a financial burden to start your own shop, but I often tell myself, “some people save for traveling, some people save for school, I saved for starting a business.” And I’m okay with it. We may not be buying yachts, but we are progressing each day, as business owners and more importantly - as people. I’m learning how the world works without the superficial, financial safety blanket that my generation grows up with.
I like to build things. I figured this out when I was young and asked to build a Roman aqueduct out of cardboard and toilet paper rolls for a school project. Not only did I succeed in my first engineering project, but I remember tweaking it all week to ensure it never leaked and looked great too.
My most recent aqueduct wasn’t such - but rather - a multi-node socket.io node.js application at Understoodit.
I learned how-to:
configure HAProxy with socket.io node.js servers
add SSL to HAProxy
scale socket.io with multiple nodes
It’s easy to build an application that runs - but can you make it scale? It’s not good enough to beef up your application server - it needs to scale horizontally. So, here’s how I went about my business.
1. Start with one-to-one:
This should be pretty straight forward. If you’re on Amazon, or any other cloud offering, you can move on. The only tricky part should be opening up the right port to the public.
2. Add a load balancer
A load balancer is a way to distribute workload across multiple servers. We use HAProxy, an open source, fast proxy server. It’s free, it’s flexible, it’s a topic of discussion online, and (most importantly) it just works! See documentation.
Once you install HAProxy - you need to run your haproxy.cfg file. Here is an example haproxy.cfg I used to get it up and running:
log 127.0.0.1 local0
frontend unsecured *:80
timeout client 86400000
option forwardfor #forward’s clients IP to app
option forwardfor #this sets X-Forwarded-For
timeout server 30000
timeout connect 4000
server server1 localhost:8001 weight 1 maxconn 1024 check
Nothing crazy here. Some things to keep note of:
Uncomment the debug statement on line 4 to help you get going.
Notice the front end called “unsecured” (line 13) is binding to port 80 (the standard open web server port). Ensure you can access your server on this port.
Notice when the connection to the LB is made, it will connect to our default backend (line 20) called “www_backend”. Our default backend is our node.js server running on port 8001 (seen on line 25) of our local machine.
3. Add an SSL certificate!
Should be easy right? Well, with the release of HAProxy Development 1.5-dev17
it is A LOT easier. Before, I was using Stud with HAProxy. It worked, but it was another process I had to keep track of. Also, it would never forward my client’s IP. If your into masochism - give it a shot. Or, just use the new version of HAProxy.
I have two frontends binding to two ports 80 and 443 - unsecure (line 13) and secure (line 17 & 22) respectively.
When a client connects on the 80 port, they are redirected to the secure 443 port.
The statement bind 0.0.0.0:443 ssl crt /etc/haproxy/yourcert.pem (line 22) connects the client to HAProxy using SSL. HAProxy will then process SSL and connect to the server. SSL is a new feature of HAProxy, if you want more details on creating your .pem file - contact me directly - it can be a pain!
Try this out - if you see a green lock like this in chrome - success!
4. Now, let’s get interesting - scale it!
The important thing with multiple socket.io servers is that we need socket.io to maintain our user’s state. We are using socket.io’s xhr-polling transport mechanism. When using xhr-polling, a socket.io process will consider a client disconnected if it doesn’t hear back. So, if we have two socket.io processes, it is important that all xhr-polling for one client is always directed to the same socket.io process. HAProxy helps ensure this by maintaining our user’s stickiness and manipulating our user’s cookie.
There are a couple differences to the HAProxy backend in the config file.
We first have to add balance roundrobin. Round Robin rotates requests among backend servers and also accepts a weight parameter which specifies their relative weight.
Next we must add the cookie SERVERID insert indirect nocache statement. This tells HAProxy to add a new parameter called SERVERID to our user’s cookie. This line is integral for ensuring that our user “sticks” to the same socket.io process - which inturn maintains our user’s state.
Our keep-alive functionality (line 18) gives us a speed boost by maintianing our clients connection open to the web server.
The only other thing we need to add is our second server and give both of our servers a cookie name. As seen in line 32 & 33 of the .cfg.
5. Test it!
Now, how do we know when our load balancer is actually working? Using Google Chrome’s developer tools, in the network tab, click on our latest GET request. From there, click on “Headers”. In the headers you will see your cookie. Within the cookie you should see a cookie parameter called SERVERID= (look familiar?)
This is HAProxy marking which which socket.io process it should route your requests to. Want to test the roundrobin-ing? Change the weight of your servers, clear your cache, and try and see what you get for SERVERID.
Once you have demonstrated you can scale two app severs, scaling out horizontally is a snap. Keep running more nodes - and keep letting HAProxy know where they live!
Funny enough, there are more similarities between Aqueducts and HAProxy than I originally thought!
At Understoodit, we’ve been hosting our node.js application on the Joyent cloud using two Small 1GB (1 vCPU) SmartOS machines for over four months. It’s snappy, reliable and costs us $124.10 a month.
But, a few holes have forced us to hosting on Amazon EC2.
I’ll explain why we chose Joyent in the first place (you should explore it too) and why we’ve switched to EC2.
Why choose Joyent:
Node & Joyent: Joyent has hired the key guys that developed Node including Ryan Lienhart Dahl (the creator a Node) and Isaac Schlueter (creator of the Node package manager and current project lead of Node) to give Node a sponsored house for it to grow. Joyent seems like the perfect place to host your node.js application.
Performance: A recent post by Matt Connolly shows the speed that Joyent provides. Talking with the guys from Joyent, they put a higher priority on performance and stability by using a “revamped infrastructure management platform”.
Customer Support: Within the first two days of provisioning my Joyent machine, I was greeted by a real person. Jeffery Bliss from Joyent was extremely knowledgable and an amazing help to provide me with some awesome details. He also included options outside of Joyent to help weigh my decision. And it was free.
Auto Scaling: If all goes well, you will have to scale your application by increasing your physical machine’s CPU speeds and RAM. With Joyent, you can do this on-the-fly without having to shutdown, provision or set up a new machine.
Data Analytics: Joyent teamed up with Nodefly and New Relic (application monitoring systems) that provide you with real-time application data. When you sign up with Joyent, you get exclusive access to both - for free.
These reasons back Joyent’s legitimacy in competing with, and in some cases, outdoing Amazon, but there were a host of reasons why we ended up deciding to switch to EC2.
Why we chose Amazon EC2:
It’s Cheaper: We have a staging environment that mirrors our production environment. With EC2 we can run our staging environment only when we are actually using it. In contrast, with Joyent, our machines must always be running (and billing). EC2 runs on a SAN (Storage area network) in which each machine is provisioned with a “virtual hard drive” and elastic IP address. In turn, you only pay for the time you have it up and costs as little as 2 cents an hour. Also, AWS provides you with some free services to get you started. It is always nice to get a taste before you pay.
We use their other services: Not only do we use AWS for EC2 but we also use Cloudfront as our CDN and look to take advantage of a few other offerings AWS provides. We also run our databases on Heroku Postgres which is on the Amazon network.
Multiple Locations: AWS allows you to provision VMs in Asia, North America, South America, Austrailia and Europe. We offer a custom version and being able to provision a machine closer to our clients is a big win. Dealing with a recent customer in the UK - we provided them a solution where their data was local (and not overseas) that was a huge selling point.
SmartOS is not Ubuntu: Joyent gives you the option to run Ubuntu, but their “house” OS is SmartOS, which has a learning curve. With SmartOS, I came across a few annoying nuances.
When trying to set up Stud for our SSL connections, I needed pull a specific version forked for SmartOS (thanks Stash). I thought I was in the clear, but inevitably ran into some privileges issues that were solved by this Solaris specific command:
pfexec crle -l /usr/local/lib -u
Not the end of the world - but it added some frustration to my installation.
I ran into another issue when trying to install the latest Haproxy with SSL (to get rid of Stud). The issue arises with the inability to install libssl-dev on SmartOS. I never found a workaround for this issue and it may have been the final deterrent for me.
Another issue I found was when trying to install syslog-ng to set up external logs through Loggly.
These issues made the experience of working with SmartOS more frustrating and added time to setting up the VMs. On second try, I’d likely just provision a Joyent machine with Ubuntu. Joyent does provide a SmartOS cheatsheet.
Aside: An interesting article by Peter Wayner points out the advantages of SmartOS as a enterprise server.
Like any decision there are tradeoffs to both. For now, it makes sense for our business to use AWS EC2 as we are not at the stage to reap the benefits that Joyent provides. I do think that Joyent is pushing the boundaries of cloud computing by providing increasingly better performance, excellent customer support, and going up against a big player in AWS with a “we are out to get you” mentality. I will definitely be keeping a close eye on Joyent and explore their options again in the future.
Here is some further reading comparing AWS EC2 vs Joyent:
I’ve named my blog Divisa C. It’s Latin for “divided 100,000”.
As of last week, I worked for IBM - which employs over 300,000 people. I quit to start Understoodit with just three.
Working for a large company has many pros and cons. I’ll start with the pros, so I can end with the cons freshly in my mind to strengthen the decision I have already made. These are some of the things I learned at IBM:
There are a lot of people: A lot of people mean a lot of resources. If you don’t know something, I guarantee that someone else does. So ask.
There is a lot of money: Which means you’ll likely get some of it. Consistently.
Their business model works: Big corporations are not in business to lose money. They’ve been around the block and know how to make it. Their success is driven from people who are making good business decisions. Be aware of the smart decisions that are made and try to fit them into your own life.
People know your company: When someone asks “what do you do?” you don’t have to fiddle around with fluffing up your day job. You can say, “I work for IBM”. People have heard of IBM. Then they will acknowledge with a smile, and you can now focus back on them. It’s incredible how easy conversations work when you are simple.
You don’t actually have to work that hard: You can - and you should. But, you don’t have to. The culture in larger organizations are convoluted. A culture mirrors the work it breeds and at IBM you could get away with doing less.
Free pens and stuff.
THERE ARE A LOT OF PEOPLE: Doing the simple things are hard. There are rules, guidelines and policies. If you need a mouse - you’ll likely need it to be signed off by your manager. And your manager’s manager. And your manager’s manager’s manager (who you’ve never met - but sits thirty feet away). You get the point.
You don’t actually WANT to work that hard: If you give a 5/10 or a 10/10, you’ll likely get a 7/10. I like to work hard - but people don’t recognize the work you’ve actually put in. Managers typically reward results when they should be rewarding effort. Effort goes unnoticed.
Culture: For someone young (I’m 26), you want to be around people like yourself. You want to work with people you’d be friends with. I don’t hang out with people over 40 that often, but I did at work. It makes for a very tangled culture with many faces. Ask 50 people what the culture is like, and you’ll get 50 different answers.
You don’t say hi to everyone: No one will look at you as you walk in the building. A smirk is the only thing you’ll get from an unknown colleague. A big company feels like a big city street. It’s unfriendly.
People don’t care: There is a diffusion of responsibility when it comes to anything. Especially when trying to develop young and eager talent. Rather then set them up for success, better drown them in boredom and uncertainty. But it’s okay, because we are giving them a pay check and dental coverage - right? Wrong.
When I first wrote this post, I thought that working for a big company had more pros than cons. But I’ve been working full-time on a startup for only a week and I’m already more enthusiastic about my day-to-day life. I’ve been very fortunate to work for a company that put up with me while I learned the ropes and I never had to worry about them NOT paying me. The fact they even paid me at all still somewhat baffles me.
But it’s time for me to be the boss. Make decisions and do work that has some greater social value. I hope you keep reading and I have something to talk about.