Opened 4 years ago
Closed 17 months ago
#334 closed enhancement (fixed)
Don't close client after every request
| Reported by: | coopstah13 | Owned by: | MickeM |
|---|---|---|---|
| Priority: | 5 | Milestone: | 0.3.7 |
| Component: | NSClientListener | Version: | 0.3.6 |
| Severity: | Feature Requests | Keywords: | |
| Cc: |
Description
I am trying to use nsclient4j to query this. Every time I make a query I have to reestablish connection to the server. This is very annoying and also consumes a lot of time. Can you make it not close the socket after every request? I have looked at source, in NSClientSocket::onAccept at the end the client is closed.
Change History (6)
comment:1 Changed 4 years ago by mickem
comment:2 Changed 4 years ago by coopstah13
Well, it is for some reason having a large impact on me. My application is querying a linux machine (rstat) and a windows machine (nscp). I am doing queries every 5 seconds and after 60 seconds the linux machine has 12 queries whereas the windows machine has 4 queries. How can I send all my queries at once before the socket closes? I am trying to query about 15 counters.
comment:3 Changed 4 years ago by mickem
humm.. in theory (I havent really tested this recently, but some one wanted it before and was happy after I added it) just send the queries like so:
1,... 2,... 3,... 4,...
then read the results:
... ... ... ...
If that does not work let me know...
In general I think were I you I would use some other protocol though better suited to polling performance counters, but I guess that would be a lot of work...
If there is an interest I might be convinced into doing something specific for you...
Michael Medin
comment:4 Changed 4 years ago by mickem
(one might also add that the socket infrastructure of NSClient++ is not geared towards high performance so you will probably not be happy trying to shoe horn it into that :)
MickeM
comment:5 Changed 4 years ago by coopstah13
- Priority changed from 3 to 5
I will check and see if that works for me. The reason I am trying to use this is because it is already written and would be less work for me overall. I haven't found anything else similar to what you have for doing what I need. The problem is I want to be able to access this from any platform, if this wasn't a requirement then obviously the easiest way would be for me to use JNI to access remote performance counters. Tomorrow I will see if your suggestion works, if not I may take a stab at implementing it myself, but will not devote much time to it. I am not going to ask of you to develop a specific feature just for me in any specific time frame. If I come up with something that works for me, I will give you the code and you can do with it as you please.
comment:6 Changed 17 months ago by mickem
- Milestone set to 0.3.7
- Resolution set to fixed
- Status changed from new to closed
presumably it worked...









humm, since it is raw sockets it should have negligible impact on preformance I would think.
Anyways, this is something I "might" do in the future but nothing I would expect in the near future.
What you can do is send all your queries in one go (ie, you can open a connection and send multiple commands over the wire) but it wont leave the socket open.
Leaving it open would lead to "other problems" such as for instance DOS attacks.
Michael Medin