Static over Dynamic

One reason I believe made Unix and Linux are very successful is their philosophy that “Everything is a file”. But the reason that this philosophy made them successful is files are relatively static than other things (Windows registry anyone?), in my opinion.

Another example would be for certain data that changes infrequently, simply put them in a static file and do a code change is much better than save in a database. Even though a code change and re-deploy is needed when change happens, but the performance and reliability is much better. A lot of time, I’ve seen people try to boost the performance by introduce caching at all levels thinking they get the good part from both: flexibility and the performance. Well what they got is complexity since cache invalidation is the second most difficult thing in computer engineering (right after naming things) according to Phil Karlton. One interesting story that I experienced first handed: One day, we accidentally stopped a service that has been running without any issue for 6 month. We thought, OK, let’s just re-start it. But it won’t, giving errors about cannot read a url. Turns out it is trying to do a one time load of some static data from an external team. The developer did not want to write a static file so he gave the justification that this is dynamic if the other team changed the data, we just need to restart the service. The other team had no idea this service depends on this url to start. There is completely no traffic on that and they removed it together with bunch of things 5 months ago.

Lastly, I have been trying to do a dev op work whole day today. I need to start a MariaDB Galera cluster. Our company’s setup script has evolved over the years from Chef to Puppet to finally Salt. I copied a set of working salt script to setup MariaDB Galera cluster from another team, but ended up reading everything in it try to understand what are the dynamic things it is doing based on host name, configurations, etc. I really wish that we are using Docker right now, because it is a file, it is static. Pull a image is basically copy paste a file. It is much much faster and guaranteed works.

Try tutum.co. You will like it.

So you tried docker a little bit, decided that it is better than whatever you had before and want to jump on it. But if you have an existing mature continues integration pipeline, you may hesitate. Because right now after you commit your code change, the rest is taken care of by your CI pipeline automatically, build, test, deploy, etc. Only when their is a problem you will be notified. However if you use docker, you find yourself need to manually type a lot of commands or start to write a lot of scripts with no pretty UI anymore. You must wonder if someone has already did this for you and the answer is Yes.

Introducing tutum.co , the one and only and best end to end solution for docker based CI pipeline. Disclaimer, I am not affiliated with them at all. I simply love their product. I switched everything I own from Heroku to here even though Heroku is free but you need to bring your own server for tutum.co . (Heroku is a great product for its time, I would have totally wrote a blog like this couple years ago if I was blogging)

I have been using tutm.co for a while. I enjoyed it all the time. But only recently I finally decided to recommend them to the world because they just solved a big problem I have. Now I think you can ignore their “Beta” flag and use them for production. (Personal opinion, not responsible for any decision you make) The problem I had was that Docker Hub sucks. I had several private repos their and I have encountered severl times that the build got backed up or completely stuck there results in the change I want to get out cannot. I don’t even make changes that frequent so I bet their actual SLA is even worse than what I experienced. It is understandable that they encounter this problem because everyone in the world is asking them to build their docker image all the time. Also they are the inventor or docker, they are system guys, probably not very experienced with service.

tutum.co solved the problem by leverage the machine of each person has, now the machine/node that I eventually will run the docker is also in charge of building the docker image. They also use the machine to run test of the docker and even though I’m not using that feature right now, believe me I will soon. And I have researched other solutions: Travis CI, Circle CI, Drone.io, some docker solutions on top of Jenkins, believe me, none of them is doing it right.

Give tutum.co a try and let me know your experience down in the comment.

Docker: compare to virtual machine part 3

In my previous post, I mentioned that Microsoft is embracing docker, partnering with them, totally jumped in to this Docker wagon. As a former Microsoft employee, that was really kind surprise to me. I feel Microsoft has become really a different company with a new CEO. Also, to correct 2 of my friends working in Microsoft: NO, Docker does not support native Windows yet as of 5/30/2015. It will though, see here.

In this post, I’m going to talk about another company that really surprised me in this Docker world – CenturyLink. Yeah, you heard me, the CenturyLink cable company that did a lot of cheesy ads on $19.99 high speed internet for 5 years which is actually DSL and bundles with phone service. I used their DSL couple years ago. The experience was in one word: nah.

But, I have no clue what got into them or maybe their Innovation Lab is a completely separated entity, they seems to be a big player in this new Docker trend. I read quite a few good articles from them about Docker and watched several interviews the conduct with key person from Docker Inc. And more related to this post, they have this amazing tool that can really help you understand what a docker image looks like. Let’s load the sample images and see what we can learn.

Sample docker image layers

Sample docker image layers

Now, image these are cakes that are upside down. Each cake have different layers but they may have the same base. And the baker can bake one huge base and then put different stuff on top of them to become different cake. Some cakes can be very similar and share more than one base but several layers. In the picture above, ruby, python and node have the first 5 layers exactly the same. Only start to be different on the 6th layer.

Unlike a cake, and unlike virtual machine, the base layers is re-used in docker and it not reused by copy paste but reused as in there is only one copy of that layer needed. So say if you have python already on your machine with all the layers python need, and now you want to get ruby, it only need to pull down 5 layers instead of 10 since you already got the first 5 layers of ruby. Compare this to a virtual machine. Say you have a virtual machine running Windows, and then on top of it Microsoft Word, now you want a virtual machine running Windows and Microsoft Excel, you have to create a virtual machine image that have a completely separated Windows instance.

Docker: compare to virtual machine part 1

They are very different of course. Docker is a type of Linux container (operating-system level software container specific to Linux). Pictures on this page is very helpful on understanding it. Now I’m going to try to explain it to you in my own words and examples hopefully you can relate to.

docker-containers-vs-vms

docker-containers-vs-vms

There are many computers operating systems. In personal computer the top 3 are: Windows, OSX and Linux. Each with many different version and flavors. Linux as a personal computer OS is mostly among developers and after Ubuntu provided a half decent GUI. Most people, when buy a personal computer, got either a PC or a Mac and it comes with Windows and OSX correspondingly. BTW, these 2 camps don’t like each other. Here is the proof.

However, occasionally because of necessity (say you need to use a software only available on the other OS) or boredom, you may need/want to be able to use both Windows and OSX. But you only have one machine, either a PC or a Mac. One way to solve this is to multi-boot. Both PC and Mac support this and you can install both Windows and OSX on a PC or Mac. It is just very hard to do. And you cannot use both operating systems at the same time.

A much easier solution would be use a virtual machine. You need to use a virtual machine software such as Virtual Box, VMWare, etc. There is a long list of such software. Using them, you can create multiple virtual machines easily and relatively faster compare to multi-boot. And you can (actually have to) use them together with the original OS on your Mac or PC. You will notice that each virtual machine you create will be saved by the virtual machine software as a big file. You can easily backup the file, move the file, even copy paste the file to create more identical virtual machines. You will also notice that the virtual machines are slow. Sometimes unbearable depends on how good is your computer. Well have a look at the picture about virtual machines on this page again. Of course it is slow. An operation need to go into the software, then the guest OS, then the virtual machine software (hypervisor in the picture, I’ll explain later), then the host OS, and then the hardware. Especially the guest OS, who has no idea that it is actually running in a virtual machine could really slow things down and it is also why the virtual machine file is very big.

Now in the server world, Linux is dominant, Windows has a meaningful percentage and I’ve never heard of Mac being used as a server though I’m sure it can. And the data center machines are huge monsters compare to personal computers. Take a look at this PowerEdge R920 from Dell. All the cloud service providers such as Amazon EC2, Microsoft Azure, etc all have quite a few data centers with a lot of powerful machines in them. And they rent them out to a lot of other companies to run their services or applications. A service may only need a tiny fraction of one server’s power, and it may suddenly need a lot more (say a e-commerce website during Christmas) and then go back to need very little. The solution is that these huge servers will start and stop virtual machines on demand. They use SSD to do disk I/O faster to help start the virtual machine faster and give it better performance. And also a lot of effort are put into make good hypervisors so the performance is good. Hypervisor is a broader concept including virtual machine software you use on your personal computer but also include specialized software and sometimes are firmware or even hardware that are used in data center with high performance.

(to be continued)

Docker: How did I find it.

I don’t really remember the exact moment I saw Docker for the first time. It’s roughly September 2014 and I definitely did not dig into it for another several months, not love at first sight. Later, my team moved production code from one data center to another in November 2014, I talked about it in one of my previous post. The process was quite chaotic and tedious. Also, we moved from CentOS to Ubuntu at the same time. During that process, I learnt a lot IT stuff that I did not have much previous exposure to as a developer: chef, puppet, salt, etc.
After took a vacation in the holiday season, early 2015 (also around when I dropped the ball on this blog) I started researching (i.e Google) for better technology/system for configure production environment and easy deployment. That’s when docker came back to me and I took a deeper look. The first time I saw the blue whale icon on www.docker.com I though of the famous fail whale from twitter. Their interactive tutorial is pretty cool and fun. I went through it so fast the first time that I missed things and had to do it twice. But I’m totally OK with it, that’s how fun it is. I highly suggest you go do it now if you are a developer or comfortable using a command line window.

docker whale

docker

Twitter fail whale

Twitter fail whale

Docker: I’m pretty sure it’s the future.

Docker is hot and getting hotter. Here is the Google Trend screen shot as of today, May 16th, 2015.

Docker Google Trends result May 16th, 2015 Screen shot

Docker Google Trends result May 16th, 2015


I don’t know when are you reading this post, so here is the real time Google Trend embedded. I bet it is going to be even better than the screen shot.

There are a few good reasons why it is so popular. There are tons of articles on the internet about benefit of docker. I’m not an expert on docker yet, just a normal user so I will only talk about my experience using it and the benefits from my perspective as a developer in my next couple blog posts.

I’m back for another try

So I totally stopped posting here for 5 months. A lot has happened in the past 5 months. But I should not give any excuses.

You never get a second chance to make a first impression. –Harlan Hogan

So I blew it the first time. I’ll just try again.

Success consists of getting up just one more time than you fall. – Oliver Goldsmith

Wish me luck.

BTW, the site is no longer running on Heroku but a docker on Azure through Tutum. That would be the topic of my next post.