# Jails vs Docker performance



## jordanch (Sep 12, 2022)

I recently came across research (Bachelors thesis) that benchmarked jails against Docker. 

The conclusion was that, except for startup time, Docker outperformed jails in almost every category (memory - writes/sec, IO, CPU - events/sec). In some categories (read from disk), Docker outperforms by a very large margin. In network performance, Jails outperforms at low container counts. 

I am curious what more educated people think might underlie this difference in performance. 

Of course, one explanation is that benchmarking tests are usually flawed and not reflective of real life. But what else?


----------



## jbo (Sep 12, 2022)

Related discussion: https://forums.freebsd.org/threads/freebsd-jails-vs-docker-a-scientific-approach.85928


----------



## jordanch (Sep 12, 2022)

Yes, I saw that thread. What I wanted was to get some technical unbiased inputs on *why* Docker could be legitimately outperforming FreeBSD in so many tests;


----------



## nordkamp (Sep 13, 2022)

jordanch said:


> Yes, I saw that thread. What I wanted was to get some technical unbiased inputs on *why* Docker could be legitimately outperforming FreeBSD in so many tests;


To be honest I don't know if I could call it "legitimately" considering there are so many variables in that paper that don't seem to be controlled. For example, they are using two completely different filesystems and virtualising two completely different operating systems, it's been shown many times that FreeBSD's kernel and Linux both outperform each other in various operations on simply the host machine, let alone variance when you introduce virtualisation technologies. In my opinion based off that fact alone this isn't really a valid comparison.

I wonder if the only way to have a valid comparison would be if Docker was native on FreeBSD, then you test a Docker FreeBSD image vs. a Jail.

EDIT: Actually another way to make a fair comparison might be taking the difference between the value in the test that the host gets vs. the value that the container gets. That way you can compare the delta over the host directly and not worry about plotting two unrelated numbers against each other like they're doing in the paper.


----------



## Jose (Sep 13, 2022)

Also, their load test scripts are written in Python. Does the Python interpreter perform as well on Freebsd as it does on Linux?

To be interesting you'd have to run a bench using only the lowest common denominator. Probably C library and POSIX shell.


----------



## jbo (Sep 13, 2022)

Jose said:


> Probably C library and POSIX shell.


Summoning zirias@


----------

