Logo
My Account |  Site Map | Contact Us  
Welcome Guest Search | Active Topics | Sign In | Register

HOWTO Make the ResourceHandler run faster. Options
JSB
Posted: Monday, July 24, 2017 3:12:50 PM
Rank: Advanced Member
Groups: Member

Joined: 1/2/2017
Posts: 32
Please help,

I'm using a ResourceHandler for HTTP. I tried the "sample" one too, but at that time, I did not know we could intercept HTTP.
At any rate, my ResourceHandler works fine so far, but it is very slow. I made my logic with my ResourceHandler be easily disabled by a simple flag, and can run my app with the ResourceHandler and without it, and the speed when using the ResourceHandler is drastically slow. Taking like 5 seconds to load my first page, as opposed to less than a second, when not using my ResourceHandler.

Now to clarify, I've been testing solely with a DEBUG build, and I am aware of the issue with trying to put break points in the ResourceHandler "Match" can cause timing issues, for which, I'm not trying to debug the "Match". And to speak of the "Match", my function simply returns "true", literally as such:

public override bool Match(EO.WebBrowser.Request reqParam) { return true; }

As for when where the speed is so slow, is before it even gets to my ProcessRequest function. This is literally where I see the 5+ seconds, BEFORE this function gets called. And where I have no break point. I know this, as I put Console.WriteLine in the ProcessRequest, to see the time.

Is there something I can do to speed it up?
JSB
Posted: Monday, July 24, 2017 3:54:04 PM
Rank: Advanced Member
Groups: Member

Joined: 1/2/2017
Posts: 32
I have more information on this issue. After doing some tracing, I'm seeing my first EO.WebBrowser's navigation going to the web server, DESPITE having called RegisterResourceHandler in my form's constructor long before setting the "Url" which I do in the "Form_Load" event. In this trace, I see the web server is immediately getting a TCP socket being dropped.

This call is definitely why there is so much extra time, in all activity the EO.WebBrowser before it gets to my ResourceHandler.

Should I call the RegisterResourceHandler sooner? All samples show it being set in the form's constructor.
Is there something else I should do?
eo_support
Posted: Monday, July 24, 2017 11:13:16 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 23,072
Hi,

There should not be such significant delay when it comes to when your ProcessRequest is called. If you still have problems, please try to isolate the problem into a test project and send the test project to us. We will be happy to take a look as soon as we have that. See here for more details on how to send the test project to us:

https://www.essentialobjects.com/forum/test_project.aspx

Thanks!
JSB
Posted: Tuesday, July 25, 2017 12:47:50 PM
Rank: Advanced Member
Groups: Member

Joined: 1/2/2017
Posts: 32
I have new information on this issue. I have traced the problem to my ResourceHandler. Inside of it, I tried to create a TcpClient object, using the constructor version that takes a server and port. This version, does in fact, "initialize" and "connect" a socket communication, which in turn, lead to my ResourceHandler, calling my web service.

The reference to the TcpClient is here: https://msdn.microsoft.com/en-us/library/115ytk56(v=vs.110).aspx
It's documentation says this: Initializes a new instance of the TcpClient class and connects to the specified port on the specified host

Someone would ask, why did I have a TcpClient object in my ResourceHandler, and that was so I could mimic a client socket call, to then invoke my web server logic, "as-is" which relies on a TcpClient. After finally discovering this, I realized I did not actually need a TcpClient to mimic the call and use my web service logic from my ResourceHandler "as-is".

Hopefully, this will help others, not fall into this trap.


Hopefully, this will spare others from falling into the same trap.
eo_support
Posted: Tuesday, July 25, 2017 10:22:18 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 23,072
Glad to hear that you have found out the root of the problem and thanks for sharing!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.