Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upNetstat input is consuming a lot of CPU on server with 120K established connections #6559
Comments
|
@jimis Would you be able to help us collect a few profiles? Our documentation for profiling needs a bit of work first though, we will get back to you with an update that has more precise instructions. |
|
Yes I can do some profiling. I already tried to grab some gdb backtraces to see where the threads are kept busy, but all I got was question marks instead of function names. Are you binaries shipping with debug info? FYI, on this server it is InfluxDB that has thousands of connections in ESTABLISHED state. There is an issue there, because I see a slow but constant upwards trend in the number of connections (as logged by telegraf), and the number gets reset only when I restart influxd. I hope I'll fix this issue soon, which will significantly reduce the number of connections. Until then I can definitely profile telegraf. |
|
I don't think profiling is necessary, I have verified that the slowness is in the inputs.netstat plugin. What I did to verify this:
I believe it should be easy for you to replicate the scenario, by providing a fake EDIT: I might be wrong about |
|
Opened shirou/gopsutil#784 for that, feel free to comment. In my opinion, telegraf shouldn't use gopsutil for something so simple, but better open directly the relevant file. |
|
@glinton I see you added the upstream label, but I have to disagree, after reading a bunch of comments in issues in gopsutil. gopsutil is having the job to parse and return information from every single process in the system. While telegraf can do much better by opening only one generic file. @danielnelson I see you removed the |
|
I'll answer over on the gopsutil issue too, it may make sense for us to have a custom linux implementation because gopsutil is reporting the pid, and we don't need it in this plugin. I don't think the pid can be obtained from |
|
If you can work on an implementation that uses the |
|
I can get tcp netstat from |
@JoveYu I would /guess/ it is the number of udp sockets the system keeps track of. Probably the number of lines of some of the files |
|
i hava rewrite netstat plugin in linux, it can help fix this issue |
|
@danielnelson thanks for pointing me to this open ticket. |
|
What version of telegraf client has the fix @JoveYu and @danielnelson |
|
Still working on the fix in #6772. |
telegraf-1.12.3 with data collection interval 10s, sending data to influxDB
OS: Linux x86_64