Don't waste your energy on Docker, it says here – wait, that can't be right...
Long tasks that consume more juice are worth it, though
Docker may be the darling of DevOps, but it's something of a minor extravagance when it comes to energy consumption.
Computer science boffins affiliated with the University of Alberta in Canada have spent some time comparing the energy used running software applications in Docker containers with power consumption on bare metal Linux servers.
In a paper titled "How does Docker affect energy consumption? Evaluating workloads in and out of Docker containers," professor Abram Hindle and research colleagues Eddie Antonio Santos, Carson McLean and Christopher Solinas observe that the convenience of Docker comes at a cost.
"This work suggests that there is no free lunch for containerization in terms of energy consumption," the paper states. "Containerization implies a trade-off between energy and maintainability, and it is up to the individuals or teams in charge of deployment to determine which is more costly in their particular scenario."
In a phone interview with The Register, Hindle explained that, for I/O bound tasks, applications running in Docker containers use more energy than those same applications running on bare metal machines because they take longer. While it's admittedly an obvious problem, it's good to have the issue quantified.
Energy consumption is power in watts multiplied by the time required to complete the job.
"What we're finding with Docker is it uses more energy to do the same task because it's slightly inefficient in terms of I/O," said Hindle. "Basically you're taking a hit for the abstraction."
Docker on its own is slightly inefficient, because the dockerd process uses power even when idle, something attributed to Docker's Go processes like garbage collection.
"Simply running dockerd idle induces a 2 watt difference in average power, and thus an increase in energy over time," the paper explains. "However, the increase in energy consumption may mostly be attributed to runtime performance."
For CPU-bound tasks, like in-memory Redis processing, Hindle said the loss is negligible. Where it matters, particularly at scale, is when there's file, disk, or network access, as there is when working with a PostgreSQL database, for example.
According to Hindle, the energy trade-off between containerization and enabling TLS/SSL is comparable for PostgreSQL.
Hindle stressed that Docker containers offer many benefits that may matter more to organizations than the efficiency of bare metal servers. "If your expenses are people, then Docker is probably worth the hit," he said. ®