In a few weeks, the new and improved Tucows Email Service will be promoted to the “Horizon” test environment, which will allow our partners to provision and manage test email accounts on this new system, either manually using the Reseller Web Interface (RWI) or programmatically using our API.
In anticipation of this promotion, I had an informal chat with two people who understand the new email system inside and out:
- Our Director Technical Operations and Planning, Rick Yazwinski
- Senior Systems Administrator Andrew Chasse
We spent an hour talking about the new email system, its underlying technology and the processes they used in its development. I've distilled our conversation into a series of articles in which I'll cover different aspects of the new Tucows Email Service.
Executive Summary

For the benefit of those of you who are pressed for time, here's the Executive Summary:
A Little Background
As our CEO Elliot Noss stated in our most recent podcast, email has become orders of magnitude more important than it used to be:
What has been clear to me is that the reliance that people, both individuals and businesses, now place on email in so many aspects of their lives has just taken it to a whole new level in terms of importance. So, just when you thought it couldn't get bigger, it did!

It was decided that our email service needed a complete overhaul — a from-the-ground up re-engineering in order to create a system that would allow us to provide superior service to our existing customer base and also scale to meet future needs. In order to do this, we created a “tiger team” whose sole objective was to build this new system — and under a very agressive timeline. The team would be given its own working space separate from our main offices complete with freedom for everyday office interruptions and free reign to make their own choice of technologies and working methodologies. In exchange, the team would have to deliver results in a span of time that many companies spend just generating a requirements document.
Among the goals set for out tiger team were:
- First and most importantly, the new email system had to be scalable and reliable
- It would have be capable of handling a large number of mailboxes (on the order of at least several hundred thousand, at the very least)
- It must work with our Email Defense service (Tucows' anti-spam and anti-virus system for email)
- It must support the provisioning and management of email accounts, both programmatically (via the API) and through a web-based interface (the RWI)
- It must be extensible to incorporate features that we'd like to integrate into our mail service, such as our Kiko calendaring system
- It must offer a webmail interface
- Migrations to the new system should be relatively fast and easy
I'm pleased to report that the tiger team succeeded: not only did they meet the specified goals, but they did so in the very little time they were given. Their success gave us not only the email system that you'll see in a few weeks, but also a blueprint for the future of software and services development here at Tucows.
Virtual Machines
One of the interesting things about Tucows' new Email Service is its use of virtual machines. If you're not familiar with the term, don't worry; I'm going to spend a little time explaining what they are.
You've probably encountered virtual machines before without realizing it. Virtual machine technology is what makes Java applications “write once, run anywhere”.
Without virtual machines, a programmer would write a program for a specific platform, such as Windows, Mac OS or one of the many variants of Unix. Such a program would be written for that platform's specific APIs, using the preferred programming language for that platform. These days, any platform's APIs are quite complex and take a while to master, which is why writing software for more than one platform is difficult and time-consuming.
From a programmer's point of view, a virtual machine offers the ability to write cross-platform software while requiring the programming knowledge for a single platform. That's because the virtual machine is the platform that the programmer targets. The virtual machine itself is written for several platforms, and as long as a virtual machine is written for a specific platform, the developer can target that platform without having to know anything about programming for it. The virtual machine acts as an interpreter between the programmer and the platform. Virtualization allows a programmer to write a single application that will run on a number of different platforms.

Tucows Email's Virtual Machines
Tucows Email Service makes use of virtual machines. Like the Java Virtual machine, they are pieces of software that emulate a platform. However, rather than being a facility to allow “write once, run anywhere” programming, the virtual machines we use are a way of allowing us to quickly and efficiently deploy email servers.
We make use of Xen, virtualization software that makes it possible to simultaneously run a number of operating systems on a single machine, each one having the appearance of running on its own computer, complete with its own processor, RAM and disk space. Ideally, you'd want to run such a system on a powerful server-grade machine, as its resources would be divided among the virtual machines running on it.
When you connect to the new Email Service — either via your favorite email software or through the webmail interface — you're connecting to one of the virtual machines. As far as your computer is concerned, it “thinks” it's connecting to an actual physical machine that's providing email service. In fact, it's connecting to software that emulates a machine that's being used as an email server.
Xen virtual machines are managed by the Xen Hypervisor software, which runs on the physical server machine and divides its resources among the virtual machines running on it. The physical machines on which we run Xen are Sun X4600 servers with 4 dual-core AMD Opteron processors, 16GB of RAM and high-bandwidth network interfaces, which provde plenty of computing power to be distributed to the various virtual machines.

Advantages Gained from Using Virtual Machines
At this point, you might be wondering why we're making use of virtual machine technology in our Email Service. It boils down to three important points:
- Faster development time
- Scalability
- Reliability
Let's look at each of these points.
Faster Development Time
Consider the typical development cycle, which can be thought of as being divided into four phases:
- Development: In this phase, programmers write the application.
- QA: Quality assurance staff take the code from the developers and subject it to a battery of tests.
- Staging: Once the application has passed its quality assurance tests, it’s placed on a staging server, which is meant to approximate the actual conditions (such as the hardware platform andthe demands made on it) under which it will run.
- Production: After the application passes the stagingtests, its placed on the production server and is on active duty.

One problem frequently encountered when moving application from one phase to another in the cycle is that it often “breaks”. It may have worked on the developers' machines, but once installed on the QA machines, it starts coughing up error messages. The same can happen when the application is moved from QA to Staging, or from staging to production.
The reason this happens is that the computers used in each phase are different. Even if they all have the same version of the same operating system installed on all of them, differences creep in over time as different software packages are installed on them, or as they undergo regualr maintenance and updating. In a software development and production environment, it's hard to keep different machines “in sync”.
The ideal situation would be to use the same machine in all phases of the cycle. The developers could write the program, then pass their machine to the QA team, who'd run their tests on it. Then QA could pass the machine to the staging server phase, where the technicians would plug the machine into the staging server network connection and the staging tests could be performed. Finally, the machine would be passed to the production phase, where technicians would plug the machine into the production server network connection.
The ideal situation is impractical, but virtual machines give us the next best thing. The developers, rather than working directly on their machines, would do their programming within a virtual machine environment running on their own computers. When it's time to pass the application to QA, they would not just save their application, but the entire virtual machine and pass it to QA.
QA would then take the virtual machine and run it, then run their tests on the developer's application within that virtual machine. Once the application has passed QA testing, its virtual machine would be saved and then passed to the staging phase, and after that, the production machine. Passing a virtual machine from phase to phase is the next best thing to using the same machine in all phases of development, and it's also more practical.
By using virtual machine technology in the development cycle, we eliminate the problems involved in moving between phases, which shortens development time and means that we can deliver updates more quickly.
Scalability

As demand on a service increases, more processing power is required. Typically, you add processing power by adding more servers.
The problem with adding more servers is that it's more than just plugging in new machines. There's a lot of setup involved, from installing the operating system to the applications to the run-time software and libraries required by the applications, and then there's a matter of testing the setup itself.
Since we're running our email service on virtual machines, and since the virtual machines are software, this means that adding new servers is considerably quicker and simpler. We simply copy our existing virtual machines — which have already had the software set up on them — onto new server hardware and run them.
This sort of setup also allows us not only to set up new server quickly, but to also make arrangements for short periods of extra server demand. It would be possible for us to deploy additional email server power for a few hours or a few days when needed by leasing additional server power and installing our virtual machines on it.
Reliability

An unavoidable reality in our line of work is that sooner or later, we're going to experience some kind of hardware failure. Perhaps a server machine will fail, or perhaps a server farm will be rendered offline by a network or power failure.
Xen virtualization technology lets us work around these problems because as software, it's easy to copy a virtual machine from one physical machine to another. Since our server machines can notify us that they're beginning to fail, we can copy a virtual machine from a failing server to a working machine.
Better still, the users shouldn't notice any downtime while this is happening. Xen can keep a virtual machine up and running even as it is being copied. A virtual machine in the process of being copied keeps running on the source machine until the last moment, when control is transferred to the destination machine.
Conclusion
It's not just a new email service, but it's running on a whole new platform. Our use of Xen virtualization technology allows us to deliver new services and upgrades faster, and allows our services to scale better and operate more reliably. We're looking forward to the launch of the new Tucows Email Service, and we think you'll be pleased.