Community discussions

MikroTik App
 
elico
Member Candidate
Member Candidate
Topic Author
Posts: 143
Joined: Mon Nov 07, 2016 3:23 am

openspeedtest mikrotik ready container

Tue Nov 15, 2022 4:50 am

After seeing couple issues with containers I took the liberty to compose a speedtest container based on: openspeedtest
https://openspeedtest.com/
https://github.com/openspeedtest/Speed-Test

1Gbps-local-speedtest.png
The sources for the container and the Makefile to build it for amd64/arm64/armv7:
https://github.com/elico/openspeedtest
on docker hub:
https://hub.docker.com/r/elicro/openspeedtest/tags

I delved into the container and re-created it so it would work on-top of RouterOS without any issues on port 80.

An example on how to install the container:
/interface/bridge/add name=dockers
/ip/address/add address=172.17.0.254/24 interface=dockers

/interface/veth/add name=veth2 address=172.17.0.2/24 gateway=172.17.0.254
/interface/bridge/port add bridge=dockers interface=veth2

/container/config/set registry-url=https://registry-1.docker.io tmpdir=disk1/pull

/container/envs/add name=speedtest_envs key=TZ value="Asia/Jerusalem"
/container/mount add dst=/var/log/nginx name=openspeed src=/disk1/openspeed/var
/container/add dns=172.17.0.254 remote-image=elicro/openspeedtest:latest interface=veth2 root-dir=disk1/speedtest envlist=speedtest_envs start-on-boot=yes
# wait a bit for the image to be extracted and then start it
Then just browse to:
http://172.17.0.2/

and speed test...
On my RB4011 I can reach easily to almost 1Gbps both upload and download.

If anyone have a 10Gbps link and can test it would be pretty nice.
You do not have the required permissions to view the files attached to this post.
 
User avatar
own3r1138
Long time Member
Long time Member
Posts: 680
Joined: Sun Feb 14, 2021 12:33 am
Location: Pleiades
Contact:

Re: openspeedtest mikrotik ready container

Wed Nov 16, 2022 7:45 am

Thankyou for sharing.
2022-11-16_09-13-45.jpg
You do not have the required permissions to view the files attached to this post.
Last edited by own3r1138 on Wed Nov 16, 2022 4:50 pm, edited 1 time in total.
 
User avatar
mkx
Forum Guru
Forum Guru
Posts: 11381
Joined: Thu Mar 03, 2016 10:23 pm

Re: openspeedtest mikrotik ready container

Wed Nov 16, 2022 9:55 am

How does this test (server side in container) perform on a mid-range Routerboard? Is it light enough on CPU to saturate 1Gbps LAN without hitting CPU limit?
 
User avatar
antonsb
MikroTik Support
MikroTik Support
Posts: 385
Joined: Sun Jul 24, 2016 3:12 pm
Location: Riga, Latvia

Re: openspeedtest mikrotik ready container

Wed Nov 16, 2022 11:13 am

nice job! Thanks for sharing!
 
elico
Member Candidate
Member Candidate
Topic Author
Posts: 143
Joined: Mon Nov 07, 2016 3:23 am

Re: openspeedtest mikrotik ready container

Wed Nov 16, 2022 7:43 pm

How does this test (server side in container) perform on a mid-range Routerboard? Is it light enough on CPU to saturate 1Gbps LAN without hitting CPU limit?
(First it got max to 70% CPU utilization)

And well.. it's based on Javascript/html5 and nginx.
It's really a very simple speed test but well written.
There are actually two files ie downloading and upload (if I remember by heart right).
Everything is from RAM on the RB4011 and the files are 0k for the upload and the downloading is a bit bigger.
It utilizes multiple(6) tcp streams. I know that for a single stream you won't get this speed.
The idea of this and other speedtests are to make sure that the "cable" can handle the 1Gbps and not test that every stream by itself can be streamed at 1Gbps.
Also, nginx is configured to use send_file and it makes it possible to "offload" the IO operations from RAM/DISK CACHE internally to the kernel which probably has the proper driver for the switch and interfaces.

On my tests the CPU load (for 6 streams..) doesn't get above 70% and I believe it's probably because of the v7 kernel.
 
User avatar
mkx
Forum Guru
Forum Guru
Posts: 11381
Joined: Thu Mar 03, 2016 10:23 pm

Re: openspeedtest mikrotik ready container

Thu Nov 17, 2022 9:18 pm

Thanks for the performance overview.
70% CPU load on RB4011 is quite a lot, there are routers that can run containers and have slower CPUs. Those will struggle to fill a 1Gbps line (regardless the number of parallel connections). It seems quite better than MT's own bandwidth test tool though.
 
dksoft
Member Candidate
Member Candidate
Posts: 148
Joined: Thu Dec 06, 2012 8:56 am
Location: Germany

Re: openspeedtest mikrotik ready container

Thu Nov 17, 2022 10:06 pm

Any idea what is going wrong here? Maybe the user is not root?

Thanks,
dksoft
Nov 17 21:02:55 router container,info,debug INFO: /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
Nov 17 21:02:55 router container,info,debug INFO: /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
Nov 17 21:02:55 router container,info,debug INFO: /docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
Nov 17 21:02:55 router container,info,debug INFO: 10-listen-on-ipv6-by-default.sh: info: /etc/nginx/conf.d/default.conf is not a file or does not exist
Nov 17 21:02:55 router container,info,debug INFO: /docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
Nov 17 21:02:55 router container,info,debug INFO: /docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
Nov 17 21:02:55 router container,info,debug INFO: /docker-entrypoint.sh: Configuration complete; ready for start up
Nov 17 21:02:55 router container,info,debug INFO: nginx: [alert] could not open error log file: open() "/var/log/nginx/error.log" failed (13: Permission denied)
Nov 17 21:02:55 router container,info,debug INFO: nginx: [emerg] bind() to 0.0.0.0:80 failed (13: Permission denied)
 
elico
Member Candidate
Member Candidate
Topic Author
Posts: 143
Joined: Mon Nov 07, 2016 3:23 am

Re: openspeedtest mikrotik ready container

Fri Nov 18, 2022 1:34 am

Any idea what is going wrong here? Maybe the user is not root?

Thanks,
dksoft
Nov 17 21:02:55 router container,info,debug INFO: /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
Nov 17 21:02:55 router container,info,debug INFO: /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
Nov 17 21:02:55 router container,info,debug INFO: /docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
Nov 17 21:02:55 router container,info,debug INFO: 10-listen-on-ipv6-by-default.sh: info: /etc/nginx/conf.d/default.conf is not a file or does not exist
Nov 17 21:02:55 router container,info,debug INFO: /docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
Nov 17 21:02:55 router container,info,debug INFO: /docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
Nov 17 21:02:55 router container,info,debug INFO: /docker-entrypoint.sh: Configuration complete; ready for start up
Nov 17 21:02:55 router container,info,debug INFO: nginx: [alert] could not open error log file: open() "/var/log/nginx/error.log" failed (13: Permission denied)
Nov 17 21:02:55 router container,info,debug INFO: nginx: [emerg] bind() to 0.0.0.0:80 failed (13: Permission denied)
What container image are you running with this issue?
There are two different issues, the first is that the container is unable to write to the log file.
The second is that it's unable to bind port 80.
The issue with the port 80 is probably because the running user is not allowed to bind the port.
I just about to release a rustdesk-server container and it is based on an nginx one with supervised.
I will later on try to publish a simple nginx web server example based on alpine+supervised+nginx and we will see what from there.

By the way, the 70% cpu was the peek for a sec... most of the time it was below 20%.
 
dksoft
Member Candidate
Member Candidate
Posts: 148
Joined: Thu Dec 06, 2012 8:56 am
Location: Germany

Re: openspeedtest mikrotik ready container  Topic is solved

Sat Nov 19, 2022 11:36 pm

Dear Elico,

thanks for taking care of my problem. I was using your container as referenced above.

I noticed that you set "USER 101" in the Dockerfile before you start the daemon. That is the daemon is not running as root and I guess that it therefore can note write to /var/log and can not bind to a priviledged port in my environment.
Therefore I downloaded your Dockerfile from github and removed the "USER 101" before nginx is started. Also I used the official nginx container. Since then the container is running perfectly.

BTW: Test result on CCR2116 is 9769/9322 on 10G Ethernet at a 16% load peak.

Thanks for the code
dksoft
 
elico
Member Candidate
Member Candidate
Topic Author
Posts: 143
Joined: Mon Nov 07, 2016 3:23 am

Re: openspeedtest mikrotik ready container

Sun Nov 20, 2022 1:53 am

Thanks for the details.
~20% for 10Gbps is not really a lot.
I just wanted to add that not all clients are equal and not all of them can handle even 1Gbps to begin with.
Most recent hardware and browsers can handle this but I have been running speed tests against clients Desktops and Servers for the last 7 plus years with many different pieces of software and in many cases the issue was not that test target but rather the test client.

Another pieces of software that are worth implementing in a container are:
* A speedtest client which will be triggered periodically to verify the line actually supplying the paid service (not in peek hours..)
* Graphing service like cacti or grafana+Prometheus
* monitoring software like Nagios
* Altering services for Slack/Telegram/WhatsApp/SMS/Others
* RouterOS "client" specific management web ui or API (which will trigger actions via RouterOS REST api), separating the device like in other products to control and data planes. This is due to the fact that many clients just get confused by the rich interfaces(winbox/web/cli) of RouterOS.
* SSH jump host/server
* Rich Corporate proxy service with much more options then what exists already in RouterOS
* Syslog target service to analyze and alert on specific brute force or other events
* crowdsec like services that might push ips to an ip firewall address-list
* tiny git services like gogs, Gitea, gitolite , gitlab runner (don't even think about a full gitlab!!!)
* Nextcloud
* MariaDB or Mysql
* pydio (https://hub.docker.com/r/linuxserver/pydio/tags) demo at: https://demo.pydio.com/
* Kanboard, wekan

All The Bests,
Eliezer
Dear Elico,

thanks for taking care of my problem. I was using your container as referenced above.

I noticed that you set "USER 101" in the Dockerfile before you start the daemon. That is the daemon is not running as root and I guess that it therefore can note write to /var/log and can not bind to a priviledged port in my environment.
Therefore I downloaded your Dockerfile from github and removed the "USER 101" before nginx is started. Also I used the official nginx container. Since then the container is running perfectly.

BTW: Test result on CCR2116 is 9769/9322 on 10G Ethernet at a 16% load peak.

Thanks for the code
dksoft
 
User avatar
StubArea51
Trainer
Trainer
Posts: 1739
Joined: Fri Aug 10, 2012 6:46 am
Location: stubarea51.net
Contact:

Re: openspeedtest mikrotik ready container

Mon Nov 21, 2022 3:42 pm

I just tested this on my CCR2116 at home. It's great!

Thanks for all the work you put in :)
 
User avatar
sirbryan
Member Candidate
Member Candidate
Posts: 298
Joined: Fri May 29, 2020 6:40 pm
Location: Utah
Contact:

Re: openspeedtest mikrotik ready container

Tue Nov 22, 2022 7:09 pm

I also loaded it on a CCR2116 at home and tested to my Mac Studio with 10GBE. Got 9.7Gbps down and 7.7Gbps up with 6% peak CPU load (7.6).

Now to test it with customer installs.
 
User avatar
jvanhambelgium
Forum Veteran
Forum Veteran
Posts: 985
Joined: Thu Jul 14, 2016 9:29 pm
Location: Belgium

Re: openspeedtest mikrotik ready container

Thu Jan 12, 2023 11:41 pm

I've just performed the update to ROS 7.7 STABLE on the RB5009 and this container does not want to start anymore :
Screenshot from 2023-01-12 22-39-51.png
Any clue why this suddenly happens ? On 7.6 I never saw this.
What is the fix for this ? It does not look like I can pass an ENV-variable forcing a port on certain number or something.
You do not have the required permissions to view the files attached to this post.
 
elico
Member Candidate
Member Candidate
Topic Author
Posts: 143
Joined: Mon Nov 07, 2016 3:23 am

Re: openspeedtest mikrotik ready container

Sat Jan 14, 2023 8:50 pm

What are you quotting whole preceding post for? Do this help undertending the conversation? No. Use "Post Reply" button.
Will test.
...
OK so I have tested and it seems that there is an issue with the container running as unprivileged user on 7.7.
From what I understood the Support team is aware of this issue and plan to fix this in 7.8.

I have built the container to be based on root user.
I do believe that another webserver can be used instead of nginx.
I was thinking about a golang based webserver.
I will run some tests later on to see if it's a good idea.
...
Aprantly the Golang basic http server is unable to compete with nginx in the upload and download speed tests on My tiny HAP AC3.
With Nginx I am able to test to the full speed of the line and with a golang server I am only able to reach 800~ Mbps download and 20-30~ Mbps upload.
At least now I understand why OpenSpeedtest chose nginx compared to couple options.
Last edited by BartoszP on Wed Jan 18, 2023 8:02 am, edited 1 time in total.
Reason: removed excessive quotting of preceding post; be wise, quote smart, save network traffic
 
User avatar
sirbryan
Member Candidate
Member Candidate
Posts: 298
Joined: Fri May 29, 2020 6:40 pm
Location: Utah
Contact:

Re: openspeedtest mikrotik ready container

Tue Jan 17, 2023 11:17 pm

I've just performed the update to ROS 7.7 STABLE on the RB5009 and this container does not want to start anymore :

Screenshot from 2023-01-12 22-39-51.png

Any clue why this suddenly happens ? On 7.6 I never saw this.
What is the fix for this ? It does not look like I can pass an ENV-variable forcing a port on certain number or something.
I upgraded as well and thought I had done something to fix this before. Looks like it's a 7.7 issue.

I ended up pulling the repo to my Mac, edited the Dockerfile to remove the second USER line (keeping it as root), then copied it to the router where it started up just fine.
 
cdhtlr
newbie
Posts: 26
Joined: Fri Jan 27, 2023 10:23 pm

Re: openspeedtest mikrotik ready container

Sun Jan 29, 2023 8:54 am

Hi Elizer,

Thanks for sharing this openspeedtest image, I have tried it, very useful to test my computer network performance.

I'm interested about the speedtest software implementation. Periodic speedtest images can be found for free on dockerhub but the image size is too big and less integrated with my router.

So I modified the speedtest software on github and made it compatible with Netwatch HTTP-GET mode. If you are interested, you can open my post on viewtopic.php?t=193053

Because this image is compatible with Netwatch, you can also do a periodic speedtest.

Hope you like this.
Thanks for the details.
~20% for 10Gbps is not really a lot.
I just wanted to add that not all clients are equal and not all of them can handle even 1Gbps to begin with.
Most recent hardware and browsers can handle this but I have been running speed tests against clients Desktops and Servers for the last 7 plus years with many different pieces of software and in many cases the issue was not that test target but rather the test client.

Another pieces of software that are worth implementing in a container are:
* A speedtest client which will be triggered periodically to verify the line actually supplying the paid service (not in peek hours..)
* Graphing service like cacti or grafana+Prometheus
* monitoring software like Nagios
* Altering services for Slack/Telegram/WhatsApp/SMS/Others
* RouterOS "client" specific management web ui or API (which will trigger actions via RouterOS REST api), separating the device like in other products to control and data planes. This is due to the fact that many clients just get confused by the rich interfaces(winbox/web/cli) of RouterOS.
* SSH jump host/server
* Rich Corporate proxy service with much more options then what exists already in RouterOS
* Syslog target service to analyze and alert on specific brute force or other events
* crowdsec like services that might push ips to an ip firewall address-list
* tiny git services like gogs, Gitea, gitolite , gitlab runner (don't even think about a full gitlab!!!)
* Nextcloud
* MariaDB or Mysql
* pydio (https://hub.docker.com/r/linuxserver/pydio/tags) demo at: https://demo.pydio.com/
* Kanboard, wekan

All The Bests,
Eliezer
 
holvoetn
Forum Guru
Forum Guru
Posts: 5317
Joined: Tue Apr 13, 2021 2:14 am
Location: Belgium

Re: openspeedtest mikrotik ready container

Fri May 19, 2023 1:17 pm

Installed on RB5009.
Max CPU 59%, giving results as expected for 1Gb-eth interfaces.

Thanks for sharing !
 
gigabyte091
Forum Guru
Forum Guru
Posts: 1153
Joined: Fri Dec 31, 2021 11:44 am
Location: Croatia

Re: openspeedtest mikrotik ready container

Sun Jul 16, 2023 8:27 am

I'm having a problem installing container, everytime i get an error: "not enough disk space to downlad layer" I have 32GB disk connected to ax3
 
holvoetn
Forum Guru
Forum Guru
Posts: 5317
Joined: Tue Apr 13, 2021 2:14 am
Location: Belgium

Re: openspeedtest mikrotik ready container

Sun Jul 16, 2023 9:26 am

Best to start a new thread with export of your config so we don't pollute this one too much.

Who is online

Users browsing this forum: No registered users and 8 guests