I have two virtual machines, call them A and B.

Both images have Ubuntu 18.04 with kernel 4.15.0-66-generic #75-Ubuntu SMP, x64 arch, 1 core Intel(R) Xeon(R) CPU E5-2660 v2 @ 2.20GHz; A has 2 GB memory while B has 4 GB memory. All updates have been installed. Both vm on the same virtualization infrastructure.

Notable services running on both: sshd, postgresql.

On vm B, an Oracle 12 RDBMS was previously installed and then removed (some system parameters were modified, I have made a diff of /sbin/sysctl -a ).

Both virtual machines have been upgraded from Ubuntu 16.04 to Ubuntu 18.04.

The issue is the following:

I have an extremely simple Django 2 web application (code below), using python 3.7 inside virtualenv; the web app does nothing, except running the embedded web server listening on localhost.

  • on vm A, the web application executes with 0% CPU usage
  • on VM B, the same web application consumes costantly between 10% and 20% of CPU on vm B. (All the other processes consume apparently 0% CPU). I am using top and htop.

I have used cProfile to profile the python web app on both virtual machines: the result is that, in both cases, nearly all (> 99%) the cpu time is spent on waitpid system call (according to "tottime" value reported by cProfile).

Regarding the diff of /bin/sysctl -a, these are the differences which might (or might be not) of interest:

  • fs.aio-max-nr = 1048576
  • fs.epoll.max_user_watches = 814612
  • fs.file-max = 6815744
  • kernel.shmall = 2097152
  • kernel.shmmax = 8589934592
  • kernel.threads-max = 31074

Any ideas? Hints? Is there an issue with Linux configuration (due to Oracle requirements)? Is there an issue with Python interpreter? Am I looking in the wrong place?

I know that I can destroy and regenerate vm B, but I would like to understand what is going on, it is an interesting technical issue.

The extremely simple Django web application was generated using these commands:

source venv/bin/activate  # venv is a python 3.7.5 virtualenv with Django package
mkdir test
cd test
django-admin startproject mysite
cd mysite
python manage.py runserver

  • That's very odd indeed. Webapps should do nothing when there's nothing accessing them. So to ask the obvious question, what's accessing the two apps, have you confirmed equal load across the two? – Philip Couling Nov 12 '19 at 17:46
  • nothing is accessing the two web apps: integrated web server is running and listening on tcp port 80 but no http requests at al. Also straced both web apps and behaviour is identical. – mrtexaz Nov 13 '19 at 8:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.