Coder Social home page Coder Social logo

Hosting on heroku about hit-counter HOT 9 OPEN

brentvollebregt avatar brentvollebregt commented on May 14, 2024
Hosting on heroku

from hit-counter.

Comments (9)

fluential avatar fluential commented on May 14, 2024

@zubair-temi the problem is that python by itself is very slow, try this uwsgi+nxing #13

from hit-counter.

zubair-temi avatar zubair-temi commented on May 14, 2024

@fluential Well, then I'd better not use this at all. I'm getting reasonable API response time (on average sub-500ms) on heroku which works for me now. If I'd need more performance, I'd port it to golang.

stats:  {
  totalElapsed: 3918.5201469659805,
  main: {
    meter: {
      mean: 19.664531856285347,
      count: 77,
      currentRate: 29.67619221666306,
      '1MinuteRate': 0,
      '5MinuteRate': 0,
      '15MinuteRate': 0
    },
    histogram: {
      min: 288.20108902454376,
      max: 1496.9496248960495,
      sum: 37145.473836660385,
      variance: 149351.9639121301,
      mean: 482.40875112545956,
      stddev: 386.4608180813808,
      count: 77,
      median: 346.6487469673157,
      p75: 373.0026630163193,
      p95: 1488.0008405685426,
      p99: 1496.9496248960495,
      p999: 1496.9496248960495
    }
  }
}

from hit-counter.

fluential avatar fluential commented on May 14, 2024

@zubair-temi Most likely you are right. In terms of python for yet better performance consider using ASGI frameworks instead of WSGI. Out of the box try running this image https://github.com/tiangolo/meinheld-gunicorn-flask-docker this is as fast as wsgi flask can go.

from hit-counter.

fluential avatar fluential commented on May 14, 2024

@zubair-temi If you are crazy about performance you should go for rust instead :)

from hit-counter.

zubair-temi avatar zubair-temi commented on May 14, 2024

@fluential "Go for rust". Pun intended? 😄

from hit-counter.

brentvollebregt avatar brentvollebregt commented on May 14, 2024

In terms of the speed, I know pythonanywhere is slow, but for my original use case, I didn't mind it. Python is another factor to the speed but I don't this it's anything comparable to the delay from pythonanywhere.

I mentioned in #13, maybe I could use peewee to fix the database issues we are facing - which will allow us to then use MySQL, Postgresql, CockroachDB and the default SQLite.

from hit-counter.

fluential avatar fluential commented on May 14, 2024

@zubair-temi you could try running under https://github.com/tiangolo/meinheld-gunicorn-flask-docker and give use some numbers ?;)

@brentvollebregt Comparing default python to any other wsgi server is basically not even comparable. So if you need a reliable anything python please stop running via default python webserver :) More reading https://flask.palletsprojects.com/en/1.0.x/deploying/uwsgi/

PS: In the original Docker image for test I did use native pathon, but in this MR you will see that uwsgi image is now being used correctly to expose app via nginx uwsgi.

from hit-counter.

fluential avatar fluential commented on May 14, 2024

@zubair-temi @brentvollebregt this

db_connection.addView(connection, url)
is another problem, as I've mentioned in the #13 you would want to flush data periodically instead of inserting every time request hits the server. The simplest you could implement is flush ever X requests.

I suggest you run some benchmarks with current code using:

Make a change and flush every 100000 requests, comapre you might get blown away.

from hit-counter.

brentvollebregt avatar brentvollebregt commented on May 14, 2024

db_connection.addView(connection, url)

is another problem, as I've mentioned in the #13 you would want to flush data periodically instead of inserting every time request hits the server. The simplest you could implement is flush ever X requests.

Yep, I understand this is an issue also. A simple option would be to store deltas in an internal dictionary and flush every x requests as you said.

@brentvollebregt Comparing default python to any other wsgi server is basically not even comparable.

I was trying to say the speed decrease from Python is nothing compared to what I am currently loosing on python anywhere; I can see:

The API request time for pythonanywhere ranged from 2-4 seconds

from hit-counter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.