>are you looking to measure request handling time? >if so, startTime will not give you what you need since threads get >reused by many requests.
Sorry, I don't really understand what you mean. From what I see in the code the start time is set in Http11InputBuffer when processing the request header. So even if I use several threads, I guess each thread will read then the value of one request, so I don't know why it wouldn't work even if afterwards it process another request. What I want to know is the time it takes for a request since it is put in the queue until a thread is available to process it. From my tests, using this parameter fits with the number of threads and the enqueued requests. With a fixed number of threads, the more request I send, the longer it takes for the last ones to be processed. El mié., 6 mar. 2019 a las 13:46, John Dale (<jcdw...@gmail.com>) escribió: > are you looking to measure request handling time? > > if so, startTime will not give you what you need since threads get > reused by many requests. > > Sincerely, > > John > > > On 3/6/19, Helena Carbajo <helenacarbajoolm...@gmail.com> wrote: > > >I want to know how much time my requests have to wait before they are > > handle, but I finally manage to get it by inheritance. I just had to > create > > the class in the same package. > > > > Sorry to ask again about the same issue. It seems that creating the class > > in the same package is not an ideal solution either. Yet, I think the > field > > startTime would help me calculate the time requests have to wait before > > they are processed. I set a HandlerInterceptor with a preHandle method > > where I compare the startTime field with the current time. From what I > see > > the startTime is the same for all my request, where as the current time > > (which I call end_time), when requests actually start being process, is > > different. For example, when setting four threads in the server these > were > > my results: > > > > > > > > > > *start_time: 1551871519950end_time: 1551871520044waiting_time: 94* > > > > *start_time: 1551871519950* > > > > * end_time: 1551871520044 * > > > > * waiting_time: 94 * > > > > > > > > > > > > > > > > *start_time: 1551871519950end_time: 1551871520044 waiting_time: 94 > > start_time: 1551871519950end_time: 1551871520044waiting_time: 94* > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > *start_time: 1551871519966end_time: 1551871521272waiting_time: > > 1306start_time: 1551871519966end_time: 1551871521272waiting_time: > > 1306start_time: 1551871519966end_time: 1551871521272waiting_time: > > 1306start_time: 1551871519966end_time: 1551871521272waiting_time: 1306* > > > > I don't know if the behaviour depends on the http or tomcat version. I > > forgot to mention I'm using http2 and tomcat 8.5.23. > > Anyway, wouldn't it be possible to add a getter method for the field > > startTime and make it accesible through the RequestFacade method, as it > is > > done with other fields? > > > > > > > > > > El mié., 6 mar. 2019 a las 9:07, Helena Carbajo (< > > helenacarbajoolm...@gmail.com>) escribió: > > > >> >Getting closer but my question still stands. What problem are you > trying > >> >to solve. > >> > >> >Note that by the time startTime is set, a thread has been allocated so > >> >it won't give you the time you are looking for. > >> > >> I want to know how much time my requests have to wait before they are > >> handle, but I finally manage to get it by inheritance. I just had to > >> create > >> the class in the same package. > >> > >> > >> El mar., 5 mar. 2019 a las 21:55, Mark Thomas (<ma...@apache.org>) > >> escribió: > >> > >>> On 05/03/2019 14:29, Helena Carbajo wrote: > >>> > >I can think of a couple of other ways of doing this but what > problem > >>> are > >>> >> you trying to solve? > >>> > > >>> > I need it in order to calculate the time requests spend in the queue > >>> since > >>> > the arrive at the server until a thread process them. I haven't seen > >>> > any > >>> > other parameter to make this calculation. > >>> > >>> Getting closer but my question still stands. What problem are you > trying > >>> to solve. > >>> > >>> Note that by the time startTime is set, a thread has been allocated so > >>> it won't give you the time you are looking for. > >>> > >>> Mark > >>> > >>> > >>> > > >>> > Helena > >>> > > >>> > El mar., 5 mar. 2019 a las 15:25, Mark Thomas (<ma...@apache.org>) > >>> escribió: > >>> > > >>> >> I can think of a couple of other ways of doing this but what problem > >>> are > >>> >> you trying to solve? > >>> >> > >>> >> Mark > >>> >> > >>> >> > >>> >> On 05/03/2019 13:35, Helena Carbajo wrote: > >>> >>> Hi! > >>> >>> I'd like to get the startTime field of a request. The problem is > >>> >>> that > >>> >> what > >>> >>> I get is a RequestFacade, which has the > >>> >>> org.apache.catalina.connector.Request object that holds the > >>> >>> org.apache.coyote.Request object. Yet, the > >>> >>> catalina.connector.Request > >>> is > >>> >> a > >>> >>> protected field, and doesn't have a getter method either. I also > >>> tried to > >>> >>> create subclass from RequestFacade but still need the > >>> >>> org.apache.catalina.connector.Request for the constractor. So far, > >>> >>> the > >>> >> only > >>> >>> solution I've found is using reflection: > >>> >>> > >>> >>> f = request.getClass().getDeclaredField("request"); > >>> >>> f.setAccessible(true); > >>> >>> realRequest = (org.apache.catalina.connector.Request) > >>> >>> f.get(request); > >>> >>> this.coyote_request = realRequest.getCoyoteRequest(); > >>> >>> return this.coyote_request.getStartTime(); > >>> >>> > >>> >>> However, I don't think this is a good practice, so is there any way > >>> >>> to > >>> >> get > >>> >>> this field or to expose it? > >>> >>> Thank you! > >>> >>> > >>> >> > >>> >> > >>> >> > --------------------------------------------------------------------- > >>> >> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > >>> >> For additional commands, e-mail: users-h...@tomcat.apache.org > >>> >> > >>> >> > >>> > > >>> > >>> > >>> --------------------------------------------------------------------- > >>> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > >>> For additional commands, e-mail: users-h...@tomcat.apache.org > >>> > >>> > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org > >