Building a development environment with Proxmox
I’m Nishimura from the development team. Our company has been using AWS (Amazon Web Services) instances to develop learningBOX, but since some issues have arisen, we’re planning to switch to developing on our in-house servers. Table of Contents: 1. The Inconvenient Truth About AWS 2. We Considered Off-the-Shelf PCs, But... 3. We Built One 4. Installing Proxmox VE 5. Steps to Speed Up Drives on Proxmox 6. Migrating Instances from the Existing Proxmox Environment 7. So, Did It Get Faster? 8. Future Plans The Inconvenient Truth About AWS While AWS is convenient for operations, as a development environment… it’s actually not very fast. I’ve mainly been using T3 instances for development, but let’s be honest—T3 instances aren’t really fast, are they? In terms of the latest CPU equivalents, they only offer performance in the 2 GHz range. If you use C5-series or Z1d instances, you can boost performance up to around 4 GHz, but honestly, they’re expensive. If you want to use multiple cores, the cost increases several-fold. Larger instances are expensive. This ties into the point that they aren’t actually that fast—using an instance with large amounts of memory and a fast CPU can cost tens of thousands of yen per month. There’s no “just right” instance. If my development requires 2.1 GB of memory, I need an instance with 4 GB of RAM. Isn’t that a waste? You might be able to work around it somewhat with virtual memory, but the moment it exceeds the physical memory limit, processing power drops by an order of magnitude. I want to use an instance that’s just the right size. I considered a off-the-shelf PC, but… I thought about buying a standard PC and running it in a virtualized environment, but I couldn’t find one that was just right. I don’t need Windows. I really don’t. Either it can’t be removed, or removing it doesn’t make the price much cheaper. I don’t need a GPU. PCs with fast CPUs usually come equipped with high-performance GPUs. I don’t need that either. (It might be necessary if I were to set up desktop virtualization, but I haven’t tested that yet.) I don’t need a mouse or keyboard either. I don’t need them. I built one myself. If there isn’t a pre-built PC that’s just right, I’ll just build one myself! So, I built a PC for the first time in a year. The parts I used are listed below. All parts except the case are shown in the photo. For some reason, a table tennis racket case is in the shot, but it’s unrelated. Explanation of Key Components Motherboard: I didn’t have any particular preferences. CPU: Core i9 10900. I chose this for its single-threaded performance. Based on my actual usage, it seems to run stably at over 5 GHz in single-threaded tasks. I considered the 10900K as well, but I thought a 0.1GHz boost for a 20,000-yen price difference wasn’t worth it, so I settled for the 10900. DRAM: I installed 32GB of reasonably fast RAM. I’ll add more if I run out. SSD: I installed a 1TB SSD that’s reasonably fast (capable of 3GB/s). Power Supply: Heeding the divine advice that “you should buy a good power supply,” I chose a reasonably high-quality unit. Since the system will be running 24 hours a day, the power supply is crucial. GPU: For now, I’m leaving it out. Installing Proxmox VE: Using the entire PC as-is might be the fastest option, but that wouldn’t make effective use of the hardware, so I set up a virtual environment using Proxmox VE. I’m running Amazon Linux 2 in the virtual environment, and I’ll cover the steps for setting up Amazon Linux 2 in a separate article. I thought the installation would be a breeze, but the USB drive I created for the installation had bad sectors, which wasted a lot of my time. It seems I should get into the habit of checking for bad sectors when creating installation media. Steps to Speed Up Drives on Proxmox This is the kind of thing good kids shouldn’t try at home, but you can improve disk I/O in the virtual environment by enabling disk caching as much as possible. It will likely be faster than reading and writing directly without using a virtual environment. However, if the power goes out before a write operation is complete, the data will be corrupted, so good kids really shouldn’t try this. Migrating an Instance from an Existing Proxmox Environment: I ran into various snags, but I’ll skip the details since explaining them would take too long. If you read the error messages carefully, you’ll usually be able to figure things out. If you still don’t understand what’s wrong after reading the error messages, reading the source code will usually clarify things. Let’s give it our best shot. You cannot migrate an instance if it’s linked to other VMs. You also cannot migrate if it’s using a physical drive or has a CloudInit device mounted. Be sure to remove those devices. If you haven’t set up a cluster within your company yet, create one in your existing Proxmox environment and add the new virtual environment to it. To be honest, I’m not great with infrastructure, so we’re currently looking for a technical engineer to handle this aspect!!! (Based at our headquarters in Tatsuno City, Hyogo Prefecture) So, did it get faster? We compared the time taken for our company’s learningBOX tests (automated backend tests using PHPUnit). Comparison results: AWS environment (t2.small): 2.63 minutes; Old Proxmox environment (Core i5 9600K): 1.22 minutes New Proxmox environment (Core i9 10900): 1.1 minutes The difference between the bottom two environments isn’t huge, but the gap compared to the AWS environment is clear. With a c5 instance, performance improves somewhat, but the gap with the Proxmox environment remains significant. Operating Frequency During Automated Testing: When there is no load, the frequency remains stable at 2.8 GHz, but when under load, it instantly spikes to around 5 GHz. Speeding up automated testing directly improves work efficiency. Regardless of whether you practice strict TDD, automated testing is indispensable for development projects of a certain scale or larger. If a test fails or a new test is created, you cannot proceed to the next task until the automated tests have finished running. On busy days, you might run tests 20 or 30 times a day. If you can shave one minute off each test run, you save that much time, which can be used for developing new features or improving code quality. Future Plans: With the recent setup of the Proxmox environment, we now have two servers supporting the virtual environment, and we’ve also achieved migration between virtual environments. However, building a High Availability (HA) environment requires three servers. We plan to build the third environment upon the release of the Zen 3-generation Ryzen processors to realize a stable private cloud.