2

I'm using my raspberry pi model B as a web server. I chose node.js since its something i'm most comfortable with. I used nginx too because I have multiple node.js apps and wanted different domains / sub domains on the same IP.

The problem I am experiencing is poor page load / data receiving speed.

For example, my test site on the raspberry pi is loading very slowly : http://missile.io . The effects of the slow speed is even more drastic when I do a database query and return the results as json : http://missile.io/songs. I replicated the same codebase and database in an amazon EC2 micro instance and the speed is about 10x faster.

Is this because of my ISP ?

I'm using a 100Mbps connection with direct Ethernet cable on my Raspberry Pi. I don't actually experience a 100Mb/s speed, in fact when i do a simple wget to test download of a large file, i'm downloading at 250kb/s.

How can I fix my problem?

  • 2
    To embellish slightly on Dr. Avalanche's answer, a residential ISP account usually has a fast download speed and a much slower (e.g. by a factor of 10) upload speed. That is good for clients but bad for servers: if you are hosting from home, downloading from your server to the world means uploading through the ISP, which is the slower rate. – goldilocks Aug 21 '13 at 17:41
  • YEs that is true. But he said he can download at 250kb/s meaning he has a 25mbit upload.. which most likely means he has a 50 mbit or 100mbit downstream. Like Virgin Fibre or BT Infinty2. But we dont know where he is and what he is using. Shawn is what is your ISP connection? – Piotr Kula Aug 22 '13 at 15:45
  • Does the unit swap? – Thorbjørn Ravn Andersen Aug 22 '13 at 19:50
  • 1
    @ppumkin it's clear from the existing text that they're pi is serving a file, which they're pulling via wget, at 256kb/s. How you decide they have 25mbit upload is beyond me, and clearly ignoring the other factors at play. – Dr.Avalanche Aug 23 '13 at 13:23
  • 256kilobytes per second - divided by 8 (8 bits in a byte) gives you 32mega bits. You are rights as to my calculation because I always round the megabits down, just a bad habit. I assumed they pulled the a file from the Pi across the internet (from another machine, like EC2 server) at 256kilobytes per second. That is more than enough for any experimental server to serve up simple web content on an idle internet connection. Even if they have 100mbit upload which not even you knows- Clearly they have at least 32mbit which is sufficient. – Piotr Kula Aug 23 '13 at 13:41
4

There likely is no problem, this is probably what you're paying for.

I have a colocated pi serving webpages. As this is hosted in a data center with proper network I don't have this issue. If you're hosting something via your ISP and not a hosting/colo copmany you're not being realistic in your comparisons.

Just because the NIC on the pi is 100Mbps does not mean you're going to get that upload speed via a home ISP. Visit Speedtest from a desktop on the same internal network as your pi and run the test, this will give you an idea what to expect. 250Kb/s isn't uncommon for uploading on lower level residential broadand contracts.

Most ISPs also throttle network connections, do traffic shaping and many don't allow hosting servers/websites from home.

If you're concerned that your application has problems, benchmark/profile it.

2

The question seems to be asking two different things and possibly only being answered in one part.

If you have poorer download speeds, by a wide margin, when you download something from the internet to your raspberry than to your regular computer then there is something wrong with your raspberry or the network from the router to your raspberry.

if you are experiencing poor page delivery times when you are trying to access webpages from your raspberry to your local computer on your local network then you might have an issue with your setup on the raspberry.

type top in the terminal and check how much memory you have left. Check if there are any processes that go high on the CPU and stay there for a second or more. which one if so? Check how much memory mysql consumes. or whichever db you are using.

I had problem with long page loads and a hunt to remove every single trace of php in the application started. Once I got rid of that and sticked to pure node js code then I must say I am very satisfied with the speeds.

I am running v2 of pi with 512mb ram and I have provided only 16 to the graphics. I have never attached a screen so that makes it nice and lean.

I am running the processor at standard speed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.