← Back to Projects

Linux Server Farm for Scalable Android Testing

How I built a cost-effective, on-premise Android testing farm with 10 Linux machines and 100+ emulators—cutting costs and boosting reliability.

The Challenge

Cloud-based Android testing was expensive and inflexible for a client who needed to run dozens of emulators at once. I was asked to design a solution that would let them run large-scale mobile app tests in-house, without breaking the bank.

The Approach

I built a Linux server farm using 10 physical machines, each running multiple Dockerized Android emulators. The goal: maximize emulator density, keep things reliable, and make the whole setup easy to manage.

Scale: Each machine ran 8–10 emulators, for a total of 80–100 concurrent Android devices.

Reliability: If an emulator crashed or hung, it was quickly restarted. The system kept running with minimal manual intervention.

Cost Savings: By moving off the cloud, the client cut their testing costs by about 70%—while gaining more control and flexibility.

Lessons Learned

  • Start Small: We began with just a couple of machines to iron out issues before scaling up.
  • RAM and SSDs Matter: Emulators are memory-hungry and slow on HDDs. 32GB RAM and SSDs made a huge difference.
  • Keep Images Lean: Stripping down emulator images sped up startup and saved resources.
  • Health Checks Are Essential: Automated restarts kept uptime above 99%.
  • Custom Networking: Default Docker networking caused port conflicts; custom bridges solved it.
  • Document Everything: With so many moving parts, clear documentation was a lifesaver.

Results

  • 80–100 Android emulators running in parallel
  • 99%+ uptime with auto-recovery
  • ~70% cost reduction vs. cloud
  • Emulator startup time: ~45 seconds

This project proved that with the right engineering, on-premise infrastructure can deliver both performance and savings for large-scale mobile testing.

Challenges

Hardware Acceleration: Android emulators need KVM for acceptable performance. Configuring Docker to properly expose KVM devices to containers required careful setup.

Network Isolation: Each emulator needed its own network but also needed to communicate with the orchestrator. Port mapping and custom networking solved this.

Resource Contention: Without proper limits, a single misbehaving emulator could impact others. We implemented hard resource limits per container.

Reliability: Emulators occasionally crash or hang. Health monitoring with automatic restart kept the system running at 99.2% uptime.

Results

Scale: 80-100 concurrent Android emulators across 10 machines

Uptime: 99.2% with auto-recovery

Cost: Reduced testing costs by approximately 70% compared to cloud solutions

Performance: Average emulator startup time of 45 seconds

Lessons Learned

Start Small, Validate, Then Scale: Began with 2-3 machines to validate the architecture before investing in all 10. This caught several issues early that would have been painful to fix at scale.

Over-Provision RAM: Android emulators are memory-hungry. Machines with 32GB RAM ran 8-10 emulators comfortably; 16GB struggled with more than 4-5.

SSD Storage Is Non-Negotiable: Initial tests with HDDs showed emulator startup times of 3-5 minutes. Switching to SSDs brought this down to 45 seconds. The cost difference paid for itself in productivity.

Keep Emulator Images Minimal: Started with full Android images with Google Play Services. Stripped them down to only what was needed for testing, reducing startup time and memory footprint by 40%.

Build Health Checks From Day One: Early versions had no health monitoring. Emulators would hang silently, wasting resources. Comprehensive health checks with auto-restart improved uptime from 85% to 99.2%.

Network Configuration Matters: Default Docker networking caused port conflicts. Custom bridge networks with proper port allocation solved this elegantly.

Document Everything: With 10 machines and 80+ containers, documentation wasn't optional. Ansible playbooks served as both automation and documentation.

Technologies

  • Ubuntu Server 20.04 LTS
  • Docker for containerization
  • Bash scripts for automation and management
  • Android SDK, emulators, and ADB (Android Debug Bridge)

This project demonstrated that with the right approach, on-premise infrastructure can deliver both performance and savings for large-scale mobile testing.