drogonframework / drogon

Drogon: A C++14/17/20 based HTTP web application framework running on Linux/macOS/Unix/Windows
MIT License
11.44k stars 1.1k forks source link

Method to discover the number of concurrently open connections #1730

Closed neilcook closed 1 year ago

neilcook commented 1 year ago

Notice If you need support or clarification regarding the usage of Drogon in your project, visit the official Drogon support channel at gitter

Please create a new issue only if you think you have found a bug or if have a feature request/enhancement.

Is your feature request related to a problem? Please describe. When measuring whether a web server is overloaded, one good indication is the number of concurrently connected clients. As the server becomes more overloaded, and becomes slower at handling requests, the number of concurrently connected clients tends to increase as connections back up waiting to be serviced. However there is currently no way to find this out within the drogon framework.

Describe the solution you'd like I'd like a method, e.g. within HttpAppFramework, to discover the current number of active HTTP connections. In my own code I would expose this as a Prometheus gauge.

Describe alternatives you've considered None.

Additional context Add any other context or screenshots about the feature request here.

an-tao commented 1 year ago

@neilcook Thanks for your feedback, I've made a PR for this. By the way, I implemented a Prometheus exporter plugin in #1632. Feel free to check it out, and I would appreciate it if you could provide me with some advice on it.

neilcook commented 1 year ago

Thanks @an-tao! I will check out the prometheus exporter plugin. I currently use https://github.com/jupp0r/prometheus-cpp

drizzle042 commented 1 year ago

@neilcook does this solve your problem? It would be good to know. If you then this issue should be closed.

neilcook commented 1 year ago

Yes it does solve my problem