from Hacker News

Ask HN: Is there any tool to monitor the frequency of TCP requests

by Nurbek-F on 4/13/23, 6:00 PM with 2 comments

Hello! I am looking for a tool to monitor the frequency of requests I am making with my custom http client. To test the rate limiting configurations. Maybe something like a mock API server with monitoring capabilities?
  • by LinuxBender on 4/13/23, 6:25 PM

    If you mean monitor TCP from the OS rather than in a HTTP client, then IPTraf-NG [1] should fit the requirement. It is available in most Linux repositories.

    Another way to see some statistics would be to front-end the application with HAProxy [2] and pull the stats from it. HAProxy is also available in most Linux repositories. This is probably closest to the mock API server as you describe. The default statistics page shows session rates vs. packet rates but this could be used in conjunction with IPTraf-NG. [3] HAProxy can forward Layer 4 TCP connections or Layer 7 HTTP connections. Stats can be pulled from the command line. Rate limits can be set by IP, unique sessions using cookies and target URL. As a side note, HAProxy's lead developer is a member of HN. [4]

    [1] - https://github.com/iptraf-ng/iptraf-ng

    [2] - https://www.haproxy.org/

    [3] - https://www.haproxy.com/blog/exploring-the-haproxy-stats-pag...

    [4] - https://news.ycombinator.com/user?id=wtarreau