I stress tested a simple flask app which just increments a number every time you request…
- User
I stress tested a simple flask app which just increments a number every time you request an endpoint, then annother endpoint to get the total requests. I think I might have to rewrite in annother language which is faster, i had two processes running at 2000 threads each then it started getting huge lag spikes every once in wa while, when i add a third its basicalyl unusable, if you ran an actual app on this. the endpoint was capping out at 2k rps , wehn it should techincally do 3k on 2 instances. is pythons slowness to blame, flask, or something else?
this is the server: from flask import Flask, jsonify from flask_cors import CORS
app = Flask(name) CORS(app)
This will act as our “database” to store the hit count
hit_count = 0
@app.route('/hit', methods=['GET']) def hit_endpoint(): global hit_count hit_count += 1 # Increment the request count return '200', 200
@app.route('/api/dstat', methods=['GET']) def api_stats(): return jsonify(total_requests=hit_count)
if name == 'main': app.run(port=5000, debug=True)
- Assistant
- User
the debug true did do a small impact but still lower than my expected 2.9k, should I rewrite the endpoint in Go, C, or NodeJS? I want this to be able to handle at least 200Million RPS before it becomes the apps issue and not the network issue.
- Assistant
- User
what are you on about? this endpoint is meant to be stress tested, the endpouiint needs no db, cache, nothing. I wanat the program to handle as much as possible, my infrastructure is fine.
- Assistant
- User
ill learn C and have this as my starter project. i need to learn C anyway for some relating projects. I want the incoming bandwidth limites to become an issue before the application itself does its a very basic app and I honestly thought python could handle a lot more than this. I dont think anything is realyl gonna be much of consern, even the scurity as the endpoint doesnt even take user input in any shape or form, it just counts how many times it gets hit, and returns a 200 code with no data.
- Assistant