[root@ip-172-31-54-219 ~]# time innobackupex --stream=xbstream --parallel=1 ./ | nc 172.31.55.250 10001
171228 15:11:13 innobackupex: Starting the backup operation
.....
xtrabackup: Transaction log of lsn (119373249297) to (119373249297) was copied.
171228 15:25:22 completed OK!
real 14m9.385s
user 3m27.392s
sys 3m34.420s
[root@ip-172-31-54-219 ~]# time innobackupex --stream=xbstream --parallel=2 ./ | nc 172.31.55.250 10001
171228 15:38:50 innobackupex: Starting the backup operation
.....
xtrabackup: Transaction log of lsn (119373249297) to (119373249297) was copied.
171228 15:50:42 completed OK!
real 11m51.915s
user 3m31.808s
sys 3m34.740s
[root@ip-172-31-54-219 ~]# time innobackupex --stream=xbstream --parallel=4 ./ | nc 172.31.55.250 10001
171228 15:38:50 innobackupex: Starting the backup operation
.....
xtrabackup: Transaction log of lsn (119373249297) to (119373249297) was copied.
171228 16:07:28 completed OK!
real 11m51.923s
user 3m27.836s
sys 3m30.088s
XBSTREAM / SOCAT TESTS
[root@ip-172-31-54-219 ~]# time innobackupex --stream=xbstream --parallel=1 ./ | socat -u stdio TCP:172.31.55.250:10001
171228 16:13:51 innobackupex: Starting the backup operation
.......
xtrabackup: Transaction log of lsn (119373249297) to (119373249297) was copied.
171228 16:26:55 completed OK!
real 13m3.911s
user 3m8.208s
sys 2m35.160s
[root@ip-172-31-54-219 ~]# time innobackupex --stream=xbstream --parallel=2 ./ | socat -u stdio TCP:172.31.55.250:10001
171228 16:28:16 innobackupex: Starting the backup operation
.....
xtrabackup: Transaction log of lsn (119373249297) to (119373249297) was copied.
171228 16:40:08 completed OK!
real 11m51.984s
user 3m8.148s
sys 2m28.860s
[root@ip-172-31-54-219 ~]# time innobackupex --stream=xbstream --parallel=4 ./ | socat -u stdio TCP:172.31.55.250:10001
171228 16:44:54 innobackupex: Starting the backup operation
.......
xtrabackup: Transaction log of lsn (119373249297) to (119373249297) was copied.
171228 16:56:46 completed OK!
real 11m51.916s
user 3m7.460s
sys 2m24.968s
TAR / NETCAT TEST
[root@ip-172-31-54-219 ~]# time innobackupex --stream=tar --parallel=1 ./ | nc 172.31.55.250 10001
171228 17:02:26 innobackupex: Starting the backup operation
.......
xtrabackup: Transaction log of lsn (119373249297) to (119373249297) was copied.
171228 17:16:09 completed OK!
real 13m42.910s
user 3m19.696s
sys 3m47.672s
TAR / SOCAT TEST
[root@ip-172-31-54-219 ~]# time innobackupex --stream=tar --parallel=1 ./ | socat -u stdio TCP:172.31.55.250:10001
171228 17:19:59 innobackupex: Starting the backup operation
......
xtrabackup: Transaction log of lsn (119373249297) to (119373249297) was copied.
171228 17:33:03 completed OK!
real 13m3.940s
user 2m59.468s
sys 2m29.388s
Here is a summary of the output noted above, in seconds.
You’ll notice that the xbstream method outperformed the tar method once we started introducing parallel threads. You may also note that performance gains ended after 2 threads were in use and this is likely due to the fact we may have hit a networking bottleneck. Another interesting thing to note is that with a single thread, socat outperformed netcat, but when it came to using multiple threads, they were about equal. So what does this mean for moving data outside of xtrabackup / innobackupex? For my next test I decided to focus on just the large data files that I created in the test schema directory, the main reason being that xbstream can handle files, but not directories and cannot act recursively. First I used xbstream and then tried again using tar. Again, compression was not used so we could look at just the streaming method. Both netcat and socat were evaluated XBSTREAM / NETCAT TESTS
[root@ip-172-31-54-219 streamtest]# time xbstream -c -p 1 ./t* | nc 172.31.55.250 10001
real 12m25.439s
user 0m20.928s
sys 3m43.492s
[root@ip-172-31-54-219 streamtest]# time xbstream -c -p 2 ./t* | nc 172.31.55.250 10001
real 12m28.086s
user 0m22.996s
sys 3m50.972s
[root@ip-172-31-54-219 streamtest]# time xbstream -c -p 4 ./t* | nc 172.31.55.250 10001
real 13m15.775s
user 0m21.460s
sys 3m50.336s
XBSTREAM / SOCAT TESTS
[root@ip-172-31-54-219 streamtest]# time xbstream -c -p 1 ./t* | socat -u stdio TCP:172.31.55.250:10001
real 11m47.781s
user 0m17.132s
sys 2m38.168s
[root@ip-172-31-54-219 streamtest]# time xbstream -c -p 2 ./t* | socat -u stdio TCP:172.31.55.250:10001
real 11m47.707s
user 0m15.816s
sys 2m22.884s
[root@ip-172-31-54-219 streamtest]# time xbstream -c -p 4 ./t* | socat -u stdio TCP:172.31.55.250:10001
real 11m47.805s
user 0m16.796s
sys 2m36.588s
TAR / NETCAT TEST
[root@ip-172-31-54-219 streamtest]# time tar -cf - ./t* | nc 172.31.55.250 10001
real 11m47.942s
user 0m5.260s
sys 2m32.048s
TAR / SOCAT TEST
[root@ip-172-31-54-219 streamtest]# time tar -cf - ./t* | socat -u stdio TCP:172.31.55.250:10001
real 11m47.914s
user 0m4.860s
sys 1m37.632s
Here is a summary of the output noted above, in seconds.

CONCLUSION
When working with xtrabackup / innobackupex, it looks like xbstream and socat is the way to go. If you’re steaming backups and are not taking advantage of multiple threads, you should consider it. For large data copies from one server to another. It looks like you’re safe using xbstream or tar, so long as the combination of xbsteam and netcat is avoided. Considering that xbstream will not work with directories or act recursively natively, it may just be easier to stick with tar.
MySQL Database Consulting
Looking to optimize your MySQL use?
Share this
Share this
More resources
Learn more about Pythian by reading the following blogs and articles.
Your Xtrabackup cheat sheet
Backing up your MySQL instance physically with Docker
HAProxy MySQL lag awareness via systemd
Ready to unlock value from your data?
With Pythian, you can accomplish your data transformation goals and more.