Posts: 1
Joined: Tue Oct 28, 2014 11:36 am

Simultaneous FTP and OpenVPN - will the Pi cope?

Tue Oct 28, 2014 3:28 pm

I currently have a Raspberry Pi B+, running Raspbian, setup as an FTP-server (vsftpd). It receives 1 JPG image (about 30 kB) per s, saved to an NTFS-formatted USB HD, from my very basic IP camera, which can only handle classic FTP, hence vsftpd. I plan to expand this to a network of 5 cameras, so the Pi will handle 5 transactions per s, 30 kB each.

Now, I'm about to configure an OpenVPN server to allow remote viewing of the video streams from my cameras. I certainly don't want to just port forward to the cameras. The VPN will likely only see occasional traffic, perhaps a few minutes per day, but who knows, it might be more over time. Do you think the Raspberry Pi can handle the video over VPN and 5 FTP transactions/s simultaneously without any problems? I don't expect/need stellar VPN performance, but I want to avoid disruption of the FTP traffic.

I'm asking since I began this IP camera journey with the FTP server built into my Dovado PRO router, but during moderate to heavy general use of my internet connection (10/100 fiber) the FTP-server started to lag and sometimes the camera just gave up sending more images. That's why I separated the FTP function from the router with a Raspberry Pi. The Dovado router is, by the way, a decent performer with 700+ Mbit/s WAN-LAN throughput so I imagine it may be roughly on par with the Raspberry hardware.

I consider throwing in a second Raspberry Pi dedicated to running OpenVPN, but if I can manage very well with a single Pi handling FTP+OpenVPN, so much the better. Another solution would be a new router with, say, OpenWRT/Gargoyle and OpenVPN, but I'm really pleased with my Dovado regarding basic routing functionality.


Posts: 85
Joined: Thu Jul 19, 2012 10:19 am

Re: Simultaneous FTP and OpenVPN - will the Pi cope?

Sun Nov 02, 2014 9:13 am

This is a capacity planning question, and they usually come down to throughput through bottlenecks. The RPi has a number of bottlenecks. The specifications for those are:
  • the CPU, about 700MIPS, 380MFLOPS
  • the RAM, about 400MB free for applications
  • the USB 2.0 bus, which connects the USB ports and the ethernet port, about 480Mbps (megabits per second) in total for the USB bus
  • the fast ethernet port, up to 100Mbps. (megabits per second).
  • the SD card speed, somewhere between 2 to 25MBps (megabytes per second)
Use the "time" command to display the CPU and I/O load of one FTP connection. If you compare it to the specifications above you'll be handsomely inside the specifications.

The OpenVPN server will use only network interface bandwidth, CPU and RAM. We can do a small test with Apache, since it uses OpenSSL too, to get an idea of the cost of encrypting traffic on the RPi.

Code: Select all

Create a 10GB test file
[[email protected] ~]$ cd public_html
[[email protected] ~]$ dd if=/dev/zero of=test.bin bs=1 count=1 seek=$(( (10 * 1024 * 1024 * 1024) - 1))

Download without SSL
[[email protected] ~]$ wget -O /dev/null http://raspberrypi.local/~gdt/test.bin
... 5.30MB/s

Download with SSL
[[email protected] ~]$ wget -O /dev/null https://raspberrypi.local/~gdt/test.bin
...  3.13MB/s
So the Raspberry Pi's network throughput using encrypted data is about 25Mbps. I used the "top" command to determine that the bottleneck was the CPU (apache2 was 93% of available CPU).

If you determine from the "time" information above that vsftp isn't going to use much CPU and bandwidth, the you can conclude that as long as you are happy with about 10Mbps of bandwidth from the remote OpenVPN client* then both the OpenVPN server and vsftp will happy run on the same hardware.

(* ie: (10Mbps client --> server) + (10Mbps server --> internet) < (25Mbps available))

Once you get your server running, use a tool to graph usage and the consumption of bottleneck resources. Then when you have service difficulties you'll know if these are due to capacity constraints.

Posts: 1
Joined: Thu May 14, 2015 6:56 pm

Re: Simultaneous FTP and OpenVPN - will the Pi cope?

Fri Aug 24, 2018 4:38 pm

This, the perfect answer, recently setup OpenVPN on my RPI 3 B and yes, the throughout is about 25mb/s on a speedtest, but then again I didn't set it up for speed, it was for accessibility.
Next step is to setup a FTP server on the RPI for media transfer when out and about. I do have it setup for the internal network from my PC to the RPI that has a HDD attached, trying to setup for phone but need to play around some more setting and figure out ports etc. Then samba server is next 😂😂

Return to “Networking and servers”