Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Coded a speedtest script that test your server's upload and download speeds
New on LowEndTalk? Please Register and read our Community Rules.

Coded a speedtest script that test your server's upload and download speeds

blackblack Member
edited September 2013 in General
wget dl.getipaddr.net/speedtest.sh 2>/dev/null -O- | bash 


I had some motivation to write a speed test script that supports both download and upload. Currently it runs on my two spare VPSes. Please let me know if there are issues and preferably, send any security related issues via PM.


Of course providers can donate a container and I'll be sure to add a link to your site in the speedtest results. I can get by with 64 MB of ram but preferably 128 MB and no more than 5 GB of space is needed. Currently it uses 10 MB download + 10 MB per test. 100 GB/month will get you 5120 views /month :) Uploaded files are deleted once every minute and the ftp user has no shell access.


Protip: if you can't remember the command at the top of your head, visit http://dl.getipaddr.net, it'll display some other useful information as well.

Comments

  • it's working perfect ... :D

  • I get:

    ftp: bind: Address already in use
    (standard_in) 1: syntax error

  • @udk said:
    I get:

    ftp: bind: Address already in use
    (standard_in) 1: syntax error



    Try it now. If it still doesn't work, let me know which OS you're running so maybe I can emulate the issue.

  • DalCompDalComp Member
    edited September 2013
    # wget dl.getipaddr.net/speedtest.sh 2>/dev/null -O- | bash
    Speedtest from Houston, TX, USA on a shared 1 Gbps port
            Download Speed: 6.45 MB/s
    (standard_in) 1: parse error
    Speedtest from Tallinn, Estonia on a shared 1 Gbps port
            Download Speed: 1.12 MB/s
    (standard_in) 1: parse error
    Speedtest from Los Angeles, CA, USA [ generously donated by http://maximumvps.net ] on a shared 1 Gbps port
            Download Speed: 85.9 MB/s
    (standard_in) 1: parse error
    # cat /etc/redhat-release && uname -m
    CentOS release 5.8 (Final)
    i686

    Working fine on CentOS 6.4 64bit, though.

    I'm here to collect your heart

  • @DalComp said:

    # wget dl.getipaddr.net/speedtest.sh 2>/dev/null -O- | bash
    > Speedtest from Houston, TX, USA on a shared 1 Gbps port
    >         Download Speed: 6.45 MB/s
    > (standard_in) 1: parse error
    > Speedtest from Tallinn, Estonia on a shared 1 Gbps port
    >         Download Speed: 1.12 MB/s
    > (standard_in) 1: parse error
    > Speedtest from Los Angeles, CA, USA [ generously donated by http://maximumvps.net ] on a shared 1 Gbps port
    >         Download Speed: 85.9 MB/s
    > (standard_in) 1: parse error
    # cat /etc/redhat-release && uname -m
    > CentOS release 5.8 (Final)
    > i686

    Working fine on CentOS 6.4 64bit, though.



    I spun up a CentOS 5.6 container. For some reason ftp outputs the upload rates in scientific format (number.0e+power). I believe this has been corrected.

  • Working good now. :)

    I'm here to collect your heart

  • I tried it, It works good.

  • It worked :)

    [email protected]:~# wget dl.getipaddr.net/speedtest.sh 2>/dev/null -O- | bash Speedtest from Houston, TX, USA on a shared 1 Gbps port Download Speed: 2.59 MB/s Upload Speed: 2.1 MB/s Speedtest from Tallinn, Estonia on a shared 1 Gbps port Download Speed: 8.77 MB/s Upload Speed: 7.3 MB/s Speedtest from Los Angeles, CA, USA [ generously donated by http://maximumvps.net ] on a shared 1 Gbps port Download Speed: 3.55 MB/s Upload Speed: .8 MB/s

    OnePoundWebHosting.co.uk | UK XEN VPS from £2 | See their special offers starting from 12£/year here

  • udkudk Member
    edited September 2013

    Testing US locations Speedtest from Houston, TX, USA on a shared 1 Gbps port Download Speed: 1.10 MB/s (standard_in) 1: syntax error Speedtest from Los Angeles, CA, USA [ generously donated by http://maximumvps.net ] on a shared 1 Gbps port Download Speed: 2.11 MB/s (standard_in) 1: syntax error -e Testing EU locations Speedtest from Tallinn, Estonia on a shared 1 Gbps port Download Speed: 2.87 MB/s (standard_in) 1: syntax error

    That's on ubuntu server 12.04

  • image

    @udk I was unable to produce the bug on the same OS.

    Can you run this for me and tell me what it says either here or via PM?

    wget dl.getipaddr.net/test.sh 2>/dev/null -O- | bash 
  • # wget dl.getipaddr.net/test.sh 2>/dev/null -O- | bash Speedtest from Houston, TX, USA on a shared 1 Gbps port Download Speed: 1.82 MB/s upload data raw -> Connected to 209.148.94.14. 220 ProFTPD 1.3.4a Server (Speedtest) [::ffff:209.148.94.14] 331 Password required for speedtest 230 User speedtest logged in Remote system type is UNIX. Using binary mode to transfer files. local: 10mb.test remote: 10mb.test 500 Illegal PORT command 221 Goodbye.

  • jarjar Provider

    Well done sir

    Founder @ MXroute

  • ftp client is not installed, install it to continue, typically you can install it by typing
    apt-get install ftp
    yum install ftp
    depending on your OS
  • netomxnetomx Member, Moderator

    @tux said:

    ftp client is not installed, install it to continue, typically you can install it by typing
    > apt-get install ftp
    > yum install ftp
    > depending on your OS

    maybe you need to install ftp

    Thanked by 1vedran
  • Testing US locations
    Speedtest from Houston, TX, USA on a shared 1 Gbps port
            Download Speed: 2.42 MB/s
            Upload Speed:   5.5 MB/s
    Speedtest from Los Angeles, CA, USA [ generously donated by http://maximumvps.net ] on a shared 1 Gbps port
            Download Speed: 2.85 MB/s
            Upload Speed:   4.1 MB/s
    Speedtest from Dallas, TX, USA on a shared 4x1 Gbps port
            Download Speed: 2.24 MB/s
            Upload Speed:   4.6 MB/s
    
    Testing EU locations
    Speedtest from Tallinn, Estonia on a shared 1 Gbps port
            Download Speed: 5.84 MB/s
            Upload Speed:   9.4 MB/s
    
  • Maybe put this in wiki. it might be pushed down by other threads

  • udk - I think I may have fixed this by giving you the option to enable PASV mode.

    wget dl.getipaddr.net/ENABLEPASSIVESPEEDTEST 2>/dev/null && wget dl.getipaddr.net/speedtest.sh 2>/dev/null -O- | bash 



    If that still doesn't work, it's more likely that a firewall or the network you're on is preventing you from receiving data on a particular port. The server is getting a private IP as the return address, which is not route-able through the public internet.


    I added another feature that lets you force 100MB file test instead of 10MB to overcome TCP Vegas' congestion avoidance so you can get a better sample result. Please only use this when you feel absolutely necessary because it's 10 times more bandwidth overall.

    wget dl.getipaddr.net/FORCE100MBFILESPEEDTEST 2>/dev/null && wget dl.getipaddr.net/speedtest.sh 2>/dev/null -O- | bash 

    If you want more information about the options, go here.

  • @black, wget dl.getipaddr.net/ENABLEPASSIVESPEEDTEST appears to be a blank file, am I missing something?

    I'm trying this on a server without a public IP (NAT), but I didn't think that would make a difference!

    Perhaps you should consider using HTTP POST to send 10MB of data via HTTP? Would be a lot safer imo - wget even supports this.

  • blackblack Member
    edited September 2013

    udk - It is supposed to be a blank file, yeah. Basically I can't pass arguments to a live bash script so if you want certain options enabled, you wget a blank file, the speed test script checks if that file exists on your system (does not look in the file for contents) and enable that option accordingly.


    I chose an FTP upload implementation because

    1) no execution privileges on anything because the user has no way of executing any files

    2) I don't have to calculate my own speed metrics, I'm not sure if you have to with HTTP Post

    3) I'm not too familiar with php in terms of security or settings on how to set a buffer space for large files (like 100MB) that doesn't impact negatively on the speed test results.

    It does seem like it'd cut down on the problems and setup though. I'll look into it this weekend and see if I can swap out ftp for HTTP POST if I can familiarize myself properly. Thanks!

    @fly no balls no glory :D
    Feel free to have a look at the code before you run it.

  • can you not get http post speeds the exact same way you get the download speeds (using wget)?

  • blackblack Member
    edited September 2013

    @udk - I tried to get it working with wget, but wget's speed results refers to the download speed of the remote server's results, not the upload results to the server. After reading the man pages

    wget get does not currently support "multipart/form-data" for transmitting POST data; only "application/x-www-form-urlencoded".

    so that's an issue as well. I think the next step is to use curl.

    4 hours later edit:

    everything is now transferred via http using curl. wget and ftp are no longer used. Hopefully this will bypass the firewall issues. The code is a lot cleaner as well :)

  • Testing US locations
    Speedtest from Houston, TX, USA on a shared 1 Gbps port
    Download Speed: 17.67 MB/sec
    Upload speed: 6.75 MB/sec
    Speedtest from Los Angeles, CA, USA [ generously donated by http://maximumvps.net ] on a shared 1 Gbps port
    Download Speed: 13.69 MB/sec
    Upload speed: 1.54 MB/sec
    Speedtest from Dallas, TX, USA on a shared 4x1 Gbps port
    Download Speed: 53.38 MB/sec
    Upload speed: 42.99 MB/sec

    Testing EU locations
    Speedtest from Tallinn, Estonia on a shared 1 Gbps port
    Download Speed: 1.48 MB/sec
    Upload speed: .35 MB/sec

  • Nice

  • @vmunich said:
    Nice

    Thanks.
    I made some improvements in the code and it now prints the results asynchronously.

    One more test location (South Bend, Indiana) has been added due to someone's generosity.

    I might add one east coast test location (Montreal, Canada) if @MCHPhil still has some yearlies in stock.

  • Sorry to bump this but I can't edit my original post.

    I've added Buffalo NY, Clifton NJ (thanks to dedicatedminds) , Atlanta GA (thanks to hostUS).



    Speedtest also runs a CPU benchmark of how long it takes to calculate PI to 5,000 decimal places.

    Thanked by 1JerryHou
  • BrianHarrisonBrianHarrison Member, Provider

    Works great, nice work

    Reprise Hosting (AS62838) Specializing in self-managed cheap dedicated servers and and cheap VPS hosting.

  • k0nslk0nsl Member, Member without signature
    edited November 2013

    Yep, good work :)

    -k0nsl

  • JohnRoeJohnRoe Member
    edited November 2013

    working great

    Sorry for my bad English

  • I'd like to donate a VPS for this in Dallas. What do I need to do?

    Serving you the best VPS, Web hosting, dedicated servers and more - Cloud Shards | Query Foundry
    We operate the network AS62638 | Available in Syd AU and Dallas, Los Angeles and NYC USA
  • PM me a VPS sign up link and I'll set it up.

    Thanked by 1mov3
  • blackblack Member
    edited December 2013

    improvements -

    • 3 new EU locations thanks to @Maounique from prometeus
    • 1 new CA location thanks to @MCHPhil
    • moved CPU test after the network speed test (because the main reason you're using this script is to see your network speed right?). The formatting is also much better.
    • added disk IO test (because LE{B,T} love it so much)
    • default file size for download and upload has been bumped up to 100MB. It should be more accurate but the test takes longer and uses 10x more bandwidth. I'll default it to 50MB (and have an option for it to go up to 100MB) if there's too much bandwidth usage.




      to do -

    • before the speedtest, get a traceroute and actually look up the IPs to get the ISP/Carrier names and print it out in a nice format

    • have 1 main speedtest file but make two more based on location. speedtest.us.sh only contains locations in the US and speedtest.eu.sh only contains locations in the EU.

    Enjoy :)

    Thanked by 2Maounique MCHPhil
  • any github repo? would be nice to fork ;]

  • @conta said:
    any github repo? would be nice to fork ;]

    Nope, I can make a github account for it though but I see no reason to just for this piece of code. You can modify the code and re-purpose it provided that it remains open source and you give some credit to the original author. Enjoy :)

  • @black said:
    Nope, I can make a github account for it though but I see no reason to just for this piece of code. You can modify the code and re-purpose it provided that it remains open source and you give some credit to the original author. Enjoy :)

    well, it's up to you. i guess i will look in github for some similar code, it's better for me to be able to check changes of original code and merge them, than come back here and compare. i will see ;]

  • @conta said:
    well, it's up to you. i guess i will look in github for some similar code, it's better for me to be able to check changes of original code and merge them, than come back here and compare. i will see ;]

    I put the code up on github .

    What's new:

    +3 new locations in the US thanks to @HardCloud @concerto49

    +1 EU location thanks to @Ishaq

    speedtest.NA.sh and speedtest.EU.sh are available if you want to test your server in a specific region. NA = North America and EU = Europe.

    Will be pushing the latest update to github ASAP.

  • Either GVH is experiencing some massive network issues, or your script is broken. But, I'm guessing GVH is having issues again, SURPRISE!

    -------------Speed test--------------------
    Testing North America locations
    Speedtest from Los Angeles, CA, USA [ generously donated by http://maximumvps.ne                                    t ] on a shared 1 Gbps port
    

    It just froze here.

  • @TheCTS said:
    Either GVH is experiencing some massive network issues, or your script is broken. But, I'm guessing GVH is having issues again, SURPRISE!

    > -------------Speed test--------------------
    > Testing North America locations
    > Speedtest from Los Angeles, CA, USA [ generously donated by http://maximumvps.ne                                    t ] on a shared 1 Gbps port
    > 

    It just froze here.

    Let it run a bit with screen or something and see what happens.

  • @black said:
    Let it run a bit with screen or something and see what happens.

    I did for like 5 minutes, still nothing. I figured out it was GVH. It was downloading but it was only at like 40MB/100MB after 5 minutes when I checked out how big the file was.

    GVH is on a whole other level when it comes to internet speeds.

  • @TheCTS said:
    40MB/100MB after 5 minutes

    Wow, that's 0.13 MB/sec...

  • @black said:
    Wow, that's 0.13 MB/sec...

    Maybe I'll let it run over night, and just MAYBE it will be finished by the time I get up in the morning.

  • We're going to have IO issues fixed this weekend. CC is stocked in buffalo now and all our new nodes got deployed

  • meatonmeaton Member

    Worked great for me... and there seems to be a lot more test locations since you originally released this. Good job! :)

    $ cat /etc/centos-release
    CentOS release 6.5 (Final)

    $ uname -a
    Linux ded-2-lin-162-255.perfectping.com 2.6.32-431.el6.x86_64 #1 SMP Fri Nov 22 03:15:09 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

    $ wget dl.getipaddr.net/speedtest.sh 2>/dev/null -O- | bash
    -------------Speed test--------------------
    Testing North America locations
    Speedtest from Los Angeles, CA, USA [ generously donated by http://maximumvps.net ] on a shared 1 Gbps port
    Download Speed: 11.48 MB/sec
    Upload speed: 9.53 MB/sec
    Speedtest from Los Angeles, CA, USA [ generously donated by TeraFire, LLC ] on a shared 1 Gbps port
    Download Speed: 1.51 MB/sec
    Upload speed: 9.45 MB/sec
    Speedtest from Las Vegas, NV, USA [ generously donated by http://hostnun.net/ ] on a shared 200 Mbps port
    Download Speed: 4.27 MB/sec
    Upload speed: 4.36 MB/sec
    Speedtest from Dallas, TX, USA [ generously donated by http://cloudshards.com ] on a shared 1 Gbps port
    Download Speed: 25.70 MB/sec
    Upload speed: 12.57 MB/sec
    Speedtest from Chicago, IL, USA [ generously donated by http://vortexservers.com ] on a shared 1 Gbps port
    Download Speed: 25.72 MB/sec
    Upload speed: 12.61 MB/sec
    Speedtest from Beauharnois, Quebec, Canada [ generously donated by http://mycustomhosting.net ] on a shared 1000 Mbps port in / 500 Mbps port out
    Download Speed: 4.09 MB/sec
    Upload speed: 14.01 MB/sec
    Speedtest from Atlanta, GA, USA [ generously donated by http://hostus.us ] on a shared 1 Gbps port
    Download Speed: 29.83 MB/sec
    Upload speed: 13.40 MB/sec
    Speedtest from Clifton, NJ, USA [ generously donated by http://dedicatedminds.com ] on a shared 1 Gbps port
    Download Speed: 12.83 MB/sec
    Upload speed: 14.67 MB/sec
    Speedtest from Jacksonville, FL, USA [ generously donated by http://maximumvps.net ] on a shared 1 Gbps port
    Download Speed: 9.36 MB/sec
    Upload speed: 6.42 MB/sec

    Testing EU locations
    Speedtest from Tallinn, Estonia on a shared 1 Gbps port
    Download Speed: 5.69 MB/sec
    Upload speed: 6.70 MB/sec
    Speedtest from Milan, Italy [ generously donated by http://www.prometeus.net ] on a shared 1 Gbps port
    Download Speed: 10.14 MB/sec
    Upload speed: 7.14 MB/sec
    Speedtest from Frankfurt am Main, Germany [ generously donated by http://www.prometeus.net ] on a shared 1 Gbps port
    Download Speed: 5.97 MB/sec
    Upload speed: 6.63 MB/sec
    Speedtest from Bucharest, Romania [ generously donated by http://www.prometeus.net ] on a semi-dedicated 1 Gbps port
    Download Speed: 7.31 MB/sec
    Upload speed: 8.68 MB/sec
    Speedtest from Amsterdam, Netherlands on a shared 100 Mbps port
    Download Speed: .07 MB/sec
    Upload speed: 1.95 MB/sec

    Testing Asian locations
    Speedtest from Tokyo, Japan on a shared 1 Gbps port
    Download Speed: 1.30 MB/sec
    Upload speed: 2.53 MB/sec

    Testing Australian locations
    Speedtest from Sydney, Australia on a shared 1 Gbps port
    Download Speed: .45 MB/sec
    Upload speed: .21 MB/sec
    ---------------CPU test--------------------
    CPU: 24 x Intel(R) Xeon(R) CPU E5-2620 0 @ 2.00GHz
    Time taken to generate PI to 5000 decimal places with a single thread: 0m27.187s
    ----------------IO test-------------------
    Writing 1000MB file to disk
    (1.1 GB) copied, 9.8014 s, 110 MB/s

    Thanked by 1black

    Opinions expressed are solely my own and do not express the views or opinions of my employer.

  • PwnerPwner Member

    black said: default file size for download and upload has been bumped up to 100MB. It should be more accurate but the test takes longer and uses 10x more bandwidth. I'll default it to 50MB (and have an option for it to go up to 100MB) if there's too much bandwidth usage.

    Just ran the test earlier today, lucky me to have started a new month on my bandwidth. More or less (because I also used a small amount of bandwidth for other downloads/uploads) the new script uses up about 3GB of data. It takes longer, but at least the results are more accurate. Great job again with the script! :)

    Thanked by 1black
  • blackblack Member
    edited July 2014

    meaton said: Worked great for me... and there seems to be a lot more test locations since you originally released this. Good job! :)

    Thanks! Japan, Australia, Florida (USA), and most recently Portland OR (USA), has been added as speed test locations.

    Pwner said: Just ran the test earlier today, lucky me to have started a new month on my bandwidth. More or less (because I also used a small amount of bandwidth for other downloads/uploads) the new script uses up about 3GB of data. It takes longer, but at least the results are more accurate. Great job again with the script! :)

    Indeed, it does use a lot of bandwidth. There's region specific speed test files available if you want to use those.

    http://dl.getipaddr.net/speedtest.NA.sh for North America
    http://dl.getipaddr.net/speedtest.EU.sh for Europe
    http://dl.getipaddr.net/speedtest.Asia.sh for Asia
    http://dl.getipaddr.net/speedtest.AU.sh for Australia 

    Alternatively, you can modify the speed test script yourself and only test with the locations you want. I think the code is pretty clean and modularized so it shouldn't be too confusing.

    I appreciate the kind words.

  • MaouniqueMaounique Member
    edited July 2014

    It wasnt so impressive at start, but now is a comprehensive tool that is just getting better.
    Good job :)

    Just 1 thing, don't add 100 mbps shared, most people test 1 gbps ports, that is just wasting traffic, IMO.

    Thanked by 2black Dylan

    Extremist conservative user, I wish to preserve human and civil rights, free speech, freedom of the press and worship, rule of law, democracy, peace and prosperity, social mobility, etc. Now you can draw your guns.

  • My dedi server from DataShack seems too slow to upload? How can I fix it?

    -------------Speed test-------------------- Testing North America locations Speedtest from Portland, Oregon, USA [ generously donated by http://bonevm.com ] on a shared 100 Mbps port Download Speed: 10.71 MB/sec Upload speed: 5.04 MB/sec Speedtest from Los Angeles, CA, USA [ generously donated by http://maximumvps.ne t ] on a shared 1 Gbps port Download Speed: 16.59 MB/sec Upload speed: .90 MB/sec Speedtest from Los Angeles, CA, USA [ generously donated by TeraFire, LLC ] on a shared 1 Gbps port Download Speed: .77 MB/sec Upload speed: .92 MB/sec Speedtest from Las Vegas, NV, USA [ generously donated by http://hostnun.net/ ] on a shared 200 Mbps port Download Speed: 7.46 MB/sec Upload speed: .83 MB/sec Speedtest from Dallas, TX, USA [ generously donated by http://cloudshards.com ] on a shared 1 Gbps port Download Speed: 46.57 MB/sec Upload speed: 2.84 MB/sec Speedtest from Chicago, IL, USA [ generously donated by http://vortexservers.com ] on a shared 1 Gbps port Download Speed: 61.56 MB/sec Upload speed: 1.16 MB/sec Speedtest from Beauharnois, Quebec, Canada [ generously donated by http://mycust omhosting.net ] on a shared 1000 Mbps port in / 500 Mbps port out Download Speed: 40.49 MB/sec Upload speed: 1.24 MB/sec Speedtest from Atlanta, GA, USA [ generously donated by http://hostus.us ] on a shared 1 Gbps port Download Speed: 19.45 MB/sec Upload speed: 2.11 MB/sec Speedtest from Clifton, NJ, USA [ generously donated by http://dedicatedminds.co m ] on a shared 1 Gbps port Download Speed: 17.09 MB/sec Upload speed: 1.74 MB/sec Speedtest from Jacksonville, FL, USA [ generously donated by http://maximumvps.n et ] on a shared 1 Gbps port Download Speed: .86 MB/sec Upload speed: .89 MB/sec ---------------CPU test-------------------- CPU: 4 x Intel(R) Xeon(R) CPU 5150 @ 2.66GHz Time taken to generate PI to 5000 decimal places with a single thread: 0m30.060s ----------------IO test------------------- Writing 1000MB file to disk (1.1 GB) copied, 15.9133 s, 67.5 MB/s

  • MaouniqueMaounique Member
    edited July 2014

    Looks horrible, my home connection does 100 times better in cases, upload is the most used traffic in a datacenter, it is possible they oversell it to the bone or they limit it because they are asked to by the content industry, but the latter is unlikely.

    Thanked by 1NewforVPS

    Extremist conservative user, I wish to preserve human and civil rights, free speech, freedom of the press and worship, rule of law, democracy, peace and prosperity, social mobility, etc. Now you can draw your guns.

  • blackblack Member

    NewforVPS said: My dedi server from DataShack seems too slow to upload? How can I fix it?

    You can open a ticket with DataShack.

    Thanked by 2mikho NewforVPS
Sign In or Register to comment.