Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

Slow webserver


  • Please log in to reply
8 replies to this topic

#1 Wim Roeling

Wim Roeling

    Member

  • Members
  • PipPip
  • 11 posts

Posted 27 February 2012 - 11:04 AM

Hi, I experience slow download speed from the webserver (I used the small webserver as posted bij Greg Zimmers) when the response length is larger than a few KB. (Example: a 6K response takes about 8 seconds). In earlier posts I saw that a firmware update might solve this problem. Yesterday I upgraded to 4.1.1-B1, but the webserver is still slow. I'm the happy owner of more than one Netduino, and they're all having the same problem. So it can not be a hardware problem. Yesterday I rewrote the webserver so that it now supports chunked transfer. I was hoping that keeping the chunk size low would solve the problem, but it didn't. (The chunked transfer was needed anyway, in order to be able to send data larger than the Netduino's memory size). Can anyone help me to improve the download speed? Wim Roeling

#2 Stefan

Stefan

    Moderator

  • Members
  • PipPipPip
  • 1965 posts
  • LocationBreda, the Netherlands

Posted 27 February 2012 - 12:03 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.
"Fact that I'm a moderator doesn't make me an expert in things." Stefan, the eternal newb!
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs

#3 Magpie

Magpie

    Advanced Member

  • Members
  • PipPipPip
  • 279 posts
  • LocationAustralia (south island)

Posted 27 February 2012 - 01:37 PM

Hi Wim

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.
STEFF Shield High Powered Led Driver shield.

#4 emg

emg

    Advanced Member

  • Members
  • PipPipPip
  • 129 posts

Posted 27 February 2012 - 02:40 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

#5 Wim Roeling

Wim Roeling

    Member

  • Members
  • PipPip
  • 11 posts

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 Stefan

Stefan

    Moderator

  • Members
  • PipPipPip
  • 1965 posts
  • LocationBreda, the Netherlands

Posted 28 February 2012 - 11:57 AM

Hi Wim, That shouldn't take too long indeed. Do you stream directly from SD to ethernet or is the data generated in real time?
"Fact that I'm a moderator doesn't make me an expert in things." Stefan, the eternal newb!
My .NETMF projects: .NETMF Toolbox / Gadgeteer Light / Some PCB designs

#7 Magpie

Magpie

    Advanced Member

  • Members
  • PipPipPip
  • 279 posts
  • LocationAustralia (south island)

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.
STEFF Shield High Powered Led Driver shield.

#8 emg

emg

    Advanced Member

  • Members
  • PipPipPip
  • 129 posts

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 nlatin

nlatin

    New Member

  • Members
  • Pip
  • 3 posts

Posted 25 December 2013 - 06:53 PM

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

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?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.