Scaling Docker Containers with Android SDK and an Emulator in Linux Machine


CentOS Linux release 7.6.1810 (Core)

Derived from Red Hat Enterprise Linux 7.6 (Source)

Linux version 3.10.0-957.5.1.el7.x86_64 ([email protected]) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-36) (GCC) ) #1 SMP Fri Feb 1 14:54:57 UTC 2019



CPU Information:

Architecture: x86_64

CPU op-mode(s): 32-bit, 64-bit

Byte Order: Little Endian

CPU(s): 32

On-line CPU(s) list: 0-31

Thread(s) per core: 2

Core(s) per socket: 8

Socket(s): 2

NUMA node(s): 2

Vendor ID: GenuineIntel

CPU family: 6

Model: 85

Model name: Intel(R) Xeon(R) Silver 4110 CPU @ 2.10GHz

Stepping: 4

CPU MHz: 2100.000

BogoMIPS: 4200.00

Virtualization: VT-x

L1d cache: 32K

L1i cache: 32K

L2 cache: 1024K

L3 cache: 11264K

In Docker Container,

Java, Node, npm, xvrf, Android SDK, appium, kvm packages and all necessary packages are installed. Refer Dockerfile. Mine is written based on this. noVNC server is not installed.

Command to create Emulator:

avdmanager create avd --force --name emulator --abi “google_apis/x86” --package “system-images;android-28;google_apis;x86” --device 10

Command to start Emulator:

./emulator -avd emulator -no-boot-anim -no-audio -verbose -gpu off

./emulator -avd emulator -no-boot-anim -no-window -no-audio -no-jni -verbose -gpu off -qemu -enable-kvm -cpu host -m 2G

tried with both the above commands. Same Result.

In the entry point, I am starting the android emulator with the above command and start appium server.

I am trying to run 10 containers simultaneously in the machine with the above configuration. But each and every container becomes slow and nothing runs properly. Running 5 in parallel works with out any issue.

I have given different values for CPU shares, but no luck. I came through selenoid , where the speaker says that he could scale up to 30 containers in a server with good configuration. But I am failing here to run just 10 containers in parallel.

Is there anything I am missing in the android emulator? I have tried quick boot also, but no gain. Using emulators with snapshot increases Image size and also increases Block I/O usage.

I can provide more data if necessary. Any Help ?

@mykola-mokhnach any idea?

I cannot suggest nothing without having detailed perf metrics. Check at least the CPU, memory and I/O load

@mykola-mokhnach I have added more details here. Please have a look and let me know if you need anything else.

I’m talking about measuring perf under load and getting performance charts like on

Thanks @mykola-mokhnach. Actual Issue was using HDD.

We have switched to SSD and it works like charm and we could scale upto 20 emulators in a machine.