Big list of http static server one-liners

  • Just notice the difference between python2 and python3 simple http server

      $ python -m SimpleHTTPServer 8000
      $ python3 -m http.server 8000
    
    Even the python3 is nicer to read, I really like that they package the server in a module. It's almost twice as slower in my machine.

    Python2 Benchmark

      Requests per second:    606.03 [#/sec] (mean)
      Time per request:       8.250 [ms] (mean)
      Time per request:       1.650 [ms] (mean, across all concurrent requests)
      Transfer rate:          4412.05 [Kbytes/sec] received
    
    And Python3 Benchmark

      Requests per second:    412.51 [#/sec] (mean)
      Time per request:       12.121 [ms] (mean)
      Time per request:       2.424 [ms] (mean, across all concurrent requests)
      Transfer rate:          3003.17 [Kbytes/sec] received
    
    Both 1000 requests, concurrency level of 5. Listing a large directory with thousands of files.

    I usually use python simple http server to share files and provide synchronization. One hopes that with a new python release it will get faster or at least smarter, both are the same implementation with no noticeable difference, just that python3 is slower.

  • Looks like Zawinski's Law needs to be revised: "Every program attempts to expand until it can serve HTML."