Docker Community Forums

Share and learn in the Docker community.

Wsgi.simple_server is very slow in docker

Hello everyone!

I am using Python’s bundled WSGI server

from wsgiref.simple_server import make_server
to make a simple server runing in docker. But when I access web server inside docker, speed to load page is very slow. Anyone can help me?

Ok I figured it out. It appears to be an issue with Werkzeug and os’s that support ipv6.

From the Werkzeug site http://werkzeug.pocoo.org/docs/serving/:

On operating systems that support ipv6 and have it configured such as modern Linux systems, OS X 10.4 or higher as well as Windows Vista some browsers can be painfully slow if accessing your local server. The reason for this is that sometimes “localhost” is configured to be available on both ipv4 and ipv6 socktes and some browsers will try to access ipv6 first and then ivp4.

So the fix is to disable ipv6 from the localhost by commenting out the following line from my hosts file:

::1 localhost
Once I do this the latency problems go away.

I’m really digging Flask and I’m glad that it’s not a problem with the framework. I knew it couldn’t be.

I still get the same errror nothing is enhanced.