Skip to content

Instantly share code, notes, and snippets.

@Manouchehri
Manouchehri / optimal_mtu.md
Created July 12, 2022 16:37 — forked from nitred/optimal_mtu.md
Wireguard Optimal MTU

About

  • I faced bandwidth issues between a WG Peer and a WG server. Download bandwidth when downloading from WG Server to WG peer was reduced significantly and upload bandwidth was practically non existent.
  • I found a few reddit posts that said that we need to choose the right MTU. So I wrote a script to find an optimal MTU.
  • Ideally I would have liked to have run all possible MTU configurations for both WG Server and WG Peer but for simplicity I choose to fix the WG Server to the original 1420 MTU and tried all MTUs from 1280 to 1500 for the WG Peer.

Testing

  • On WG server, I started an iperf3 server
  • On WG peer, I wrote a script that does the following:
    • wg-quick down wg0
  • Edit MTU in the /etc/wireguard/wg0.conf file
@Manouchehri
Manouchehri / cpuinfo.txt
Created June 5, 2022 02:44
c7g.medium AWS
processor : 0
BogoMIPS : 2100.00
Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma lrcpc dcpop sha3 sm3 sm4 asimddp sha512 sve asimdfhm dit uscat ilrcpc flagm ssbs paca pacg dcpodp svei8mm svebf16 i8mm bf16 dgh rng
CPU implementer : 0x41
CPU architecture: 8
CPU variant : 0x1
CPU part : 0xd40
CPU revision : 1
sudo apt-get install vmfs6-tools parallel
find /dev/sd*1 -print0 | parallel -0 "sudo vmfs6-fuse {} /mnt/vmfs-{/}"
http://scw3sr02elb001-529496401.ap-northeast-1.elb.amazonaws.com/oss/dsc/DC-BGH1/bash.tar.gz
http://scw3sr02elb001-529496401.ap-northeast-1.elb.amazonaws.com/oss/dsc/DC-BGH1/coreutils.tar.gz
http://scw3sr02elb001-529496401.ap-northeast-1.elb.amazonaws.com/oss/dsc/DC-BGH1/libnl.tar.gz
http://scw3sr02elb001-529496401.ap-northeast-1.elb.amazonaws.com/oss/dsc/DC-BGH1/linux-3.18.18.tar.gz
http://scw3sr02elb001-529496401.ap-northeast-1.elb.amazonaws.com/oss/dsc/DC-BGH1/glibc.tar.gz
http://scw3sr02elb001-529496401.ap-northeast-1.elb.amazonaws.com/oss/dsc/DC-BGH1/debianutils_4.8.1.tar.xz
http://scw3sr02elb001-529496401.ap-northeast-1.elb.amazonaws.com/oss/dsc/DC-BGH1/grep.tar.gz
http://scw3sr02elb001-529496401.ap-northeast-1.elb.amazonaws.com/oss/dsc/DC-BGH1/ifupdown.tar.gz
http://scw3sr02elb001-529496401.ap-northeast-1.elb.amazonaws.com/oss/dsc/DC-BGH1/iproute2.tar.gz
http://scw3sr02elb001-529496401.ap-northeast-1.elb.amazonaws.com/oss/dsc/DC-BGH1/iptables-1.6.1.tar.bz2
ffmpeg -y -raw_format yuv422p10 -timecode_format rp188any -video_input hdmi -f decklink -i 'UltraStudio Recorder 3G' -c:a aac_at -c:v hevc_videotoolbox -profile:v main10 -realtime:v true -b:v 8M -aac_at_mode cbr -b:a 256K -color_primaries bt2020 -color_trc arib-std-b67 -color_range tv -colorspace bt2020_ncl -movflags frag_keyframe+empty_moov -tag:v hvc1 -f hls -hls_time 1 -hls_list_size 4 -hls_allow_cache 0 -hls_segment_options mpegts_flags=+pat_pmt_at_frames+resend_headers -hls_flags delete_segments+append_list -http_persistent 1 -method POST 'https://a.upload.youtube.com/http_upload_hls?cid=KEYHERE&copy=0&file=master.m3u8'
Decoding success! CMSampleBuffer 0x147106370 retainCount: 3 allocator: 0x1fb27c000
invalid = NO
dataReady = YES
makeDataReadyCallback = 0x0
makeDataReadyRefcon = 0x0
buffer-level attachments:
EditBoundary(P) = true
formatDescription = (null)
sbufToTrackReadiness = 0x0
numSamples = 0
dave@mbp Downloads % ffprobe -probesize 42M -f avfoundation -framerate 29.970000 -i "1"
[avfoundation @ 0x12f6056b0] Selected pixel format (yuv420p) is not supported by the input device.
[avfoundation @ 0x12f6056b0] Supported pixel formats:
[avfoundation @ 0x12f6056b0] uyvy422
[avfoundation @ 0x12f6056b0] yuyv422
[avfoundation @ 0x12f6056b0] nv12
[avfoundation @ 0x12f6056b0] 0rgb
[avfoundation @ 0x12f6056b0] bgr0
[avfoundation @ 0x12f6056b0] Overriding selected pixel format to use uyvy422 instead.
Input #0, avfoundation, from '1':
General
Complete name : /mnt/ios/NINJAV_S001_S001_T019.MOV
Format : MPEG-4
Format profile : QuickTime
Codec ID : qt 2005.03 (qt )
File size : 2.12 GiB
Duration : 13 s 680 ms
Overall bit rate mode : Variable
Overall bit rate : 1 331 Mb/s
Encoded date : UTC 2022-04-06 14:00:22
General
Complete name : NINJAV_S001_S001_T012.MOV
Format : MPEG-4
Format profile : QuickTime
Codec ID : qt 2005.03 (qt )
File size : 8.09 GiB
Duration : 31 s 114 ms
Overall bit rate mode : Variable
Overall bit rate : 2 235 Mb/s
Encoded date : UTC 2022-04-06 13:13:21