Reputation: 151
I try to use influxDB to save some monitor data. I started influxDB with default configuration and used python to write some test data through HTTP API in my own mac, everything going well in the beginning. But I encountered a ConnectionError every time after I wrote some data. My test code is
for event_id in xrange(0, 100000):
requests.post("http://127.0.0.1:8086/write?db=mydb", data="test_a,event={0} value=100 1538841600000000000".format(event_id))
After about 16300 executions, an error will be reported.
HTTPConnectionPool(host='127.0.0.1', port=8086): Max retries exceeded with url: /write?db=mydb (Caused by NewConnectionError("<urllib3.connection.HTTPConnection object at 0x110a5fb10>: Failed to establish a new connection: [Errno 49] Can't assign requested address",)
And then, I should wait about 2 seconds before I write new data.
My OS is MacOS 10.14, and all data is saved in an HDD hard disk.
influxDB version is vv1.6.4 (git: master c75cdfdfa6f71a08473fefcec71f6cbcbdef1ff4)
Is influxDB doing some tidying up?
Upvotes: 0
Views: 1255
Reputation: 151
OK, I found the reason, because this API is HTTP protocol and requests use TCP connection to send HTTP request, so every time a request finished, the TCP connection not closed, it will goto TIME_WAIT and wait a timeout before close. So the port resource of my OS are exhausted......
Upvotes: 1