java - How can I get the IP of the client that is sending request? -


well new , don't know how it, senior fellows please help!!!!

there situation described below:

an http client sending request (request can of type, not concerned regarding request type) directly hits loadbalancer. loadbalancer redirects traffic, based on load of traffic, towards "gateway" system running in 2 v440 server, gw logic written in java, logically routs request towards 2 server nodes process request.

enter image description here

now scene that: there several parallel connections established gateway several http clients. 1 connection per client. has been observed that, while making connections gw, in case of clients cpu utilization going 98-99%.

client creating 1 connection gw on particular port. opens socket connection:

serversocket _ss = new serversocket(_port); socket s = _ss.accept(); 

and gw waits input come client.

now question is:

  1. why kind of situation happening, seems fine rest of clients , there connections. few clients creating connections gw making situation?

  2. is there anyway can track client's ip can understand if has been occurred same clients every time?

  3. is there resolution this?

since not happening clients, not going find immediate answer this. however, limited research on question yields

firstly, question 2

configure f5 capture client's ip. since http, there multiple ways of tracking requests. 1

sniff header x-forwarded-for give client's ip address

or try adding rule in logging engine

when client_accepted { log local0. "clientip:[ip::client_addr] accessed" }

if need other data such resources can use 1 of other events such http_request:

when http_request { log local0. "clientip:[ip::client_addr] accessed [http::host][http::uri]" }

refer link above here

secondly, question 1

for need @ available traffic statistic mechanisms. read this, this , this. enable statistics, monitor them live, test, mock requests , analyze output. not know of other options other this, right now.

another option, if can modify java program include sort of performance logging mechanism each request. means there lot of development , not recommend @ all.

thirdly, question 3

this opinion based. far think if figure out problem, can resolve it.


Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -