HTTP Server Max Sessions

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

HTTP Server Max Sessions

979 Views
jschepler
Contributor III

I am having issues when first loading the webpage of an embedded webserver.  I think it is due to the amount of TCP connections Chrome is requesting when I first try to load the page.  Please read through my perceived description of the cause/problem and let me know your suggestions.   Thanks.

I am using KSDK 1.3.0 with MQX with a K64F processor.  I am hosting a webserver and have defined the max number of HTTP sessions to 2.  I noticed that when I am trying to load the webpage from a browser it takes 20 seconds for the webpage to initially load.  After it is loaded, there are no issues with the 1 second timeout refresh built-in to the webpage / javascript.

I used wireshark to view the packets.  When I type the webpage into the Chrome, and before hitting enter, Chrome already sends out 6 TCP SYN packets.  I see that the embedded webserver responds to each of the 6 SYN packets with a SYN, ACK.

When I view the task states, there are two "HTTP Server Session" tasks present.

Lets lets say the client uses ports 60001 - 60006 to connect to port 80 of the server.

The webserver, I believe, only keeps the 2 most recent sessions (60005 and 60006).  When I press enter on the address bar, wireshark shows the port of the 1st request from the client is the one requesting the HTTP page (60001).

Since this connection is not established anymore, the webserver waits up to 20 seconds (HTTPSRVCFG_SES_TO) to close 60005/60006 connections due to inactivity.  Once it is closed, then it responds to the 60001 port request.

How should I go about getting the webserver to work faster on the initial load of the page?  Should I re-compile with changing the HTTPSRVCFG_SES_TO to something like 1 second?  I don't really want to set the max number of sessions to 6 because of the limited amount of RAM on the controller.      

Labels (1)
Tags (4)
0 Kudos
1 Reply

698 Views
danielchen
NXP TechSupport
NXP TechSupport

Hi Jchepler:

Have you tried this issue with other brower? like IE or firefox?

I think you can try to set the default session to 6 or decrease the timeout value to check whether there is any improvement.

If you need good performance, you may need more memory in your system.

When a client connects to the server, the server task creates  a child task to handle communication with the accepted socket, so memory for the child task's stack is needed. There is one child task for each connected client.

I would recommend to debug this issue with TAD. There you can see how much memory is left after RTCS_create, after socket init, application layer init, like httpsever start...

However, please also refer to below thread, it might helpful for you.

https://community.nxp.com/message/320610#320610 

Regards

Daniel

0 Kudos