Ubuntu 32 or 64 bit for a Django App on Amazon EC2?

Solution 1:

There is almost no reason anymore to use 32-bit systems at all since the introduction of 64-bit ubiquity, see the respective post EC2 Updates: New Medium Instance, 64-bit Ubiquity, SSH Client:

You can now launch 64-bit operating systems on the Small and Medium instance types. This means that you can now create a single Amazon Machine Image (AMI) and run it on an extremely wide range of instance types, from the Micro all the way up to the High-CPU Extra Large and and the High-Memory Quadruple Extra Large [...]

This will make it easier for you to scale vertically (to larger and smaller instances) without having to maintain parallel (32 and 64-bit) AMIs.

Despite the cloud in general and Amazon EC2 in particular being primarily about horizontal scaling, this is still a rather significant improvement, insofar it allows to scale dedicated nodes up and down vertically as well with a simple stop/scale/start cycle, usually done in less than a minute manually (and this can of course be fully automated as well).

Consequently I'd recommend using only 64-bit instances going forward to gain the flexibility of vertical scaling; see Eric Hammond’s post Use the Same Architecture (64-bit) on All EC2 Instance Types for another, but equally enthusiastic perspective.

Solution 2:

While the typical answer is to use a 64-bit AMI, it should be noted that 32-bit operating systems use less memory, as each register is only half as wide. If memory usage is a concern for you, and you are using an instance with less than 4GB of memory (micro, small, medium) then a 32-bit operating system may offer an advantage.

Typically, there may be a small performance gain on 64-bit applications, although it is very specific to the implementation. Applications that are computationally intensive and work with large numbers may see a marked improvement in performance with a 64-bit architecture (e.g. encryption, audio/video encoding, etc).

For any instance larger with more than 4GB of memory, you must use a 64-bit AMI. If you want to retain the flexibility of changing your instance type later, then a 64-bit AMI is recommended as it works on all instances.