buglwIP - A Lightweight TCP/IP stack - Bugs: bug #31948, httpd: Improving HTTP Server...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #31948: httpd: Improving HTTP Server performance when SSI is enabled

Submitter:  Simon Goldschmidt <goldsimon>
Submitted:  Wed 22 Dec 2010 12:06:16 PM UTC
   
 
Category:  Contrib Severity:  2 - Minor
Item Group:  None Status:  Fixed
Privacy:  Public Assigned to:  goldsimon
Open/Closed:  Closed Planned Release:  None
lwIP version:  git head

Tue 11 Mar 2014 07:37:17 PM UTC, comment #3: 

Fixed.

Simon Goldschmidt <goldsimon>
Group administrator
Thu 22 Aug 2013 09:27:47 AM UTC, comment #2: 

Hi,
I also ran accross this issue on a lwip 1.3.x, running on an STM32F407.

The basic issue is the limited amount of pbufs set in lwipopts.h by TCP_SND_QUEUELEN. Each tag produces two additional queue entries. For maximum performance TCP_SND_QUEUELEN should be adjusted for the number of tags used per shtml-file.

In httpd.c 'http_send_data', during tag-processing len is set to the number of chars in a the tag, but never reset. This generates lots of calls to 'tcp_write' and thus queue entries.
I added "len = tcp_sndbuf(pcb);  // set len to full remaining buffer size" at the end of the case TAG_SENDING, when we switch back to 'hs->tag_state = TAG_NONE'.

Thanks to goldsimon for pointing me in the right direction and for the lwip.

Cheers,
 Marcus



Marcus Hasenstab <harerod>
Sun 27 Mar 2011 02:05:17 PM UTC, comment #1: 

While that might work, it wouldn't fix the LWIP_HTTPD_SSI_INCLUDE_TAG==0 case, would it?

Simon Goldschmidt <goldsimon>
Group administrator
Wed 22 Dec 2010 12:06:16 PM UTC, original submission:  

Reported on Sat, 27 Nov 2010 on lwip-users:

Dear All,

   I am using the code from CVS HEAD (lwip + contrib).  lwIP is setup
for RAW mode.  Raw HTTP server with SSI+CGI is used.

   I have a HTML file with 20 SSI tags which takes 50ms to send
(LWIP_HTTPD_TIMING and HTTPD_DEBUG_TIMING enabled).  Found out that
once a tag is sent, the number of bytes sent to function 'http_write'
is set to the tag data length.  Found a @todo in function
'http_send_data' indicating 'somewhere in this loop, 'len' should grow
again..'

   In the function 'http_send_data', in switch case TAG_LEADOUT and
TAG_SENDING there is a check for 'len' as shown below:
if(len > hs->tag_end - hs->file) {
  len = (u16_t)(hs->tag_end - hs->file);
}
    'len' is passed to function 'http_write' that in turn passes it to
function 'tcp_write'.  Since these functions take care of how much can
be sent, 'len' should be set to the parsed length.  Thus in the above
code snippet the conditional check should be removed and length should
be set as len = (u16_t)(hs->tag_end - hs->file);

    Testing with the above change reduced the send time to 10ms.

    Hope this is useful for those using large number of SSI tags.

Regards,
Jayanth

Simon Goldschmidt <goldsimon>
Group administrator

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by harerod (Posted a comment)
  • -email is unavailable- added by goldsimon (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2014-03-11 goldsimon StatusNone Fixed
        Assigned toNone goldsimon
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code