RTC Forums
May 16, 2024, 10:19:57 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   Home   Help Login Register  
Pages: [1]
  Print  
Author Topic: Get request and response sizes without using content buffering  (Read 3425 times)
GeirBerg
RTC License+
****
Posts: 13


« on: June 25, 2015, 10:02:36 AM »

Hi!

Is it possible to get the request and response sizes (content length) from a DataRouter without having to set ManualRead to false (using buffering)?
It does not matter when the information becomes available (before/during/after the request) as it is only used for logging and statistics.

If this is NOT possible, in general what impact on performance, delay, server resources, etc. can we expect from leaving ManualRead set to false?
Most calls will have quite small amounts of data in both directions (1-2 KB?), however a small percentage of the calls will have data in the order of multiple megabytes.

Unfortunately we cannot simply *test and measure* this scenario as the production servers can potentially have hundreds of simultanious users.

Regards.
Logged
D.Tkalcec (RTC)
Administrator
*****
Posts: 1881


« Reply #1 on: June 25, 2015, 10:45:15 AM »

You have access to the complete Request and Response headers currently available to the DataRouter component (including the ContentLength value, when receiving content body) in all DataRouter events throught the Sender parameter (using Request and Response properties).

All events with the Sender parameter as TRtcDataServer give you access to the complete Request headers received from the Clients, while events with the Sender parameter as TRtcDataClient give you access to the complete Response headers received from the Server, even before a single byte of the content body was recevied, so there is no need for content buffering if you are only interested in Request and Response header information (like the ContentLength value, for example). You would only need to enable content buffering if you had to modify the content body before it is being forwarded to the other side, because the ContentLength value is defined in the HTTP header (Request and Response), so it has to be set before sending the actual content.

Best Regards,
Danijel Tkalcec
Logged
GeirBerg
RTC License+
****
Posts: 13


« Reply #2 on: June 25, 2015, 11:47:54 AM »

Thank you very much! Smiley

It works just fine now. I somehow managed to confuse myself with the details of how TRtcRouterContentBody and related events works. Simply checking the 'Content-Length' header didn't occur to me. Time for a coffee break, I think.

Regards.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.023 seconds with 17 queries.