Slow webserver
#1
Posted 27 February 2012 - 11:04 AM
#2
Posted 27 February 2012 - 12:03 PM
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs
#3
Posted 27 February 2012 - 01:37 PM
The speed of a Netduino webserver does concern me too, but I am sure you can get at least 16kbytes/sec out of it. Across a LAN anyway.
Over the internet it seems quite a bit slower than that. I am not sure why this is but I might be because of the tiny tcp packet size,that it seems to generate.
Here is a link, the file is about 100k, served from a Netduino.
(please wait for a request to finish before clicking again, as my server crashes when too many requests come in.)
Are you using RegEx ? I notice my calls into that are very slow.
Also the HttpWebRequest might be the culprit, consider rolling your own.
Actually 1 kbyte/s is so slow that you should be able to step through your code and find the bottleneck in the debugger.
#4
Posted 27 February 2012 - 02:40 PM
#5
Posted 27 February 2012 - 04:42 PM
Hi Wim and welcome to the Netduino community.
A micro platform will always have more limitations then PCs. To be honest, I would never even think about making a Netduino a server. My approach for communicating with a Netduino and the web is set up differently:
I've got a webserver, with Linux, Apache, MySQL, PHP. On this server I run a small socket listener with MySQL support as well.
My Netduino connects to the socket and has an open connection all the time with the webserver. All requests are translated to a protocol that only contains data. No markup, no image files, etc. They're all stored on the webserver itself.
That method is actually very fast and makes communication with the netduino instant, without losing much resources on the Netduino.
I know this doesn't answer your question: "how to speed up the webserver", but it can help you with a faster approach.
Currently my socket listener is very beta (if not alpha), so I'm not going to share code in it's current state. But it's a project I'm working on.
Hi Stefan,
I'm not running a complete webserver on a Netduino. It's just a tiny web application to setup an intelligent device. Like you will find a lot today in network printers, routers, etc.. So a LAMP stack (Linux, Apache, MySQL, PHP) is out of the question. The largest amount of data it will ever have to send is between 10 and 20k. That's not a lot, but it takes 10 to 20 seconds. And that's way to long, I think, for a 32Mhz processor. I used to have an 8Mhz Archimedes computer (whith the first ARM processor) in the early eighties which was way faster. I just can't understand where the cycles go to.
Anyway, I'm considering a Raspberry Pi now to do the job. An amazing $25 creditcard sized Linux computer with a 700Mhz ARM and 256MB of RAM.
Regards,
Wim Roeling
#6
Posted 28 February 2012 - 11:57 AM
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs
#7
Posted 28 February 2012 - 12:59 PM
Hi Magpie,
Have you published your temp monitor project here? If not, could you? I'm doing something similar for my hot water heater and would be interested in seeing how yours works. Re-invent the wheel, etc.
Thanks,
Mike
Hi Mike, I will try and put it up on codeplex soon. this week maybe . I have a lot of 3rd party javascript which I need to post as well so I have to sort it out.
#8
Posted 28 February 2012 - 01:13 PM
Hi Mike, I will try and put it up on codeplex soon. this week maybe . I have a lot of 3rd party javascript which I need to post as well so I have to sort it out.
Thanks!
#9
Posted 25 December 2013 - 06:53 PM
I am using your gsiot library with np2 and i noticed packet fragmentation that slows web page rendering, i used wireshark and saw max packet size 128 byte. There is no router between. How to prevent packet fragmentation? How to change mtu packet size?Hi Stefan, I'm not running a complete webserver on a Netduino. It's just a tiny web application to setup an intelligent device. Like you will find a lot today in network printers, routers, etc.. So a LAMP stack (Linux, Apache, MySQL, PHP) is out of the question. The largest amount of data it will ever have to send is between 10 and 20k. That's not a lot, but it takes 10 to 20 seconds. And that's way to long, I think, for a 32Mhz processor. I used to have an 8Mhz Archimedes computer (whith the first ARM processor) in the early eighties which was way faster. I just can't understand where the cycles go to. Anyway, I'm considering a Raspberry Pi now to do the job. An amazing $25 creditcard sized Linux computer with a 700Mhz ARM and 256MB of RAM. Regards, Wim Roeling
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users