Hi All,
I'm using MQX RTCS 4.0.2 (ported into MQX 3.8.1.1) on a Freescale MPC-5125 and have found it's taking an extremely long time to send a large reply message back to a webpage hosted by the built-in MQX webserver. I'm sending about a 225K message (All ascii chars) back to the webpage and the HTTPSRV_cgi_write() function is taking approximately 10 seconds to return! Here's the general idea:
_mqx_int CGI_ServiceReq(HTTPSRV_CGI_REQ_STRUCT *param) { uint_32 lReplyLen; HTTPSRV_CGI_RES_STRUCT response; char_ptr cBuf = NULL;
//Allocate a temp buffer cBuf = _mem_alloc_system(230000);
//Load data into cBuf here.... for(lReplyLen = 0; lReplyLen < 225,000; lReplyLen++) cBuf[lReplyLen] = 0x30;
response.ses_handle = param->ses_handle; response.content_type = HTTPSRV_CONTENT_TYPE_PLAIN; response.status_code = 200; response.data = cBuf; response.data_length = lReplyLen; response.content_length = response.data_length; HTTPSRV_cgi_write(&response); _mem_free(cBuf); return(response.content_length); }
When the webpage sends a user selected binary file back to the web server, using http POST, a 2 MB file takes just a second or so. Is there some other way I should be sending replies to the webpage that contain significant amounts of data? Can the data be sent in a binary fashion and would that likely be any faster? Maybe there's an MQX buffer size issue and I would be better off breaking the message into smaller chunks (or increasing the buffer size)? I'm pretty new to working with http so I'm just doing what is displayed in the examples that Freescale provides but none of the examples was shown transferring large amounts of data. Thanks in advance for any help or suggestions.
Best Regards,
Tim
Solved! Go to Solution.
Hi All,
I've found a solution to the performance problem I described above. I changed the value of the HTTPSRVCFG_TX_BUFFER_SIZE constant from (3 * 1460) to (172 * 1460) to resize the transmit buffer from the default of 4,380 bytes to 251,120 bytes (just larger then the largest message I need to send). After rebuilding MQX with this new constant value added to the user_config.h file I tried transmitting the large reply message again and found the transmit time had dropped from around 10 seconds to a matter of milli-seconds! Fortunately, I have plenty of DDR memory on this project (256 MB) so this is a workable solution for me. Hope someone else may find this information useful.
Best Regards,
Tim
Hi All,
I've found a solution to the performance problem I described above. I changed the value of the HTTPSRVCFG_TX_BUFFER_SIZE constant from (3 * 1460) to (172 * 1460) to resize the transmit buffer from the default of 4,380 bytes to 251,120 bytes (just larger then the largest message I need to send). After rebuilding MQX with this new constant value added to the user_config.h file I tried transmitting the large reply message again and found the transmit time had dropped from around 10 seconds to a matter of milli-seconds! Fortunately, I have plenty of DDR memory on this project (256 MB) so this is a workable solution for me. Hope someone else may find this information useful.
Best Regards,
Tim
Hello Tim,
Thanks for share your solution!
Regards
Soledad