TCP Tweak

In file /etc/sysctl.conf

# tweak - start
net.core.wmem_max=33554432
net.core.rmem_max=33554432
net.ipv4.tcp_rmem= 10240 87380 33554432
net.ipv4.tcp_wmem= 10240 87380 33554432
net.ipv4.tcp_window_scaling = 1
net.ipv4.tcp_timestamps = 1
net.ipv4.tcp_sack = 1
net.ipv4.tcp_no_metrics_save = 1
net.core.netdev_max_backlog = 5000
# tweak - end

credit: https://www.cyberciti.biz/faq/linux-tcp-tuning/

In file /etc/rc.local

ip link set mtu 7000 dev enp4s0

Set MTU size by add this line

ip link set mtu [supported MTU] dev [NIC]

Check MTU size that your NIC supported first.

sudo ifconfig [NIC] mtu [MTU]
Advertisements

Fix slow network file transfer

If you’re using Linux with Windows file server on Gigabit Network, Samba max bandwidth is about 20-30MB/s. You have to install NFS and using it instead of Samba. I couldn’t find the way to make Samba able to read file from Windows share at 100+MB/s. If you could, your guide would be appreciated.

/etc/samba/smb.conf

Increase send and receive buffers size by add this line

[global]

# FORCE THE DISK SYSTEM TO ALLOCATE REAL STORAGE BLOCKS WHEN
# A FILE IS CREATED OR EXTENDED TO BE A GIVEN SIZE.
# THIS IS ONLY A GOOD OPTION FOR FILE SYSTEMS THAT SUPPORT
# UNWRITTEN EXTENTS LIKE XFS, EXT4, BTRFS, OCS2.
# IF YOU USE A FILE SYSTEM THAT DOES NOT SUPPORT UNWRITTEN
# EXTENTS, SET "strict allocate = no".
# NOTE: MAY WASTE DRIVE SPACE EVEN ON SUPPORTED FILE SYSTEMS
# SEE: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=798532

   strict allocate = Yes

# THIS IS TO COUNTERACT SPACE WASTAGE THAT CAN BE 
# CAUSED BY THE PREVIOUS OPTION 
# SEE: https://lists.samba.org/archive/samba-technical/2014-July/101304.html

   allocation roundup size = 4096

# ALLOW READS OF 65535 BYTES IN ONE PACKET.
# THIS TYPICALLY PROVIDES A MAJOR PERFORMANCE BENEFIT.

   read raw = Yes

# SUPPORT RAW WRITE SMBs WHEN TRANSFERRING DATA FROM CLIENTS.

   write raw = Yes

# WHEN "strict locking = no", THE SERVER PERFORMS FILE LOCK
# CHECKS ONLY WHEN THE CLIENT EXPLICITLY ASKS FOR THEM.
# WELL-BEHAVED CLIENTS ALWAYS ASK FOR LOCK CHECKS WHEN IT IS
# IMPORTANT, SO IN THE VAST MAJORITY OF CASES,
# "strict locking = auto" OR "strict locking = no" IS ACCEPTABLE.

   strict locking = No

# TCP_NODELAY:
#    SEND AS MANY PACKETS AS NECESSARY TO KEEP DELAY LOW
# IPTOS_LOWDELAY:
#    [Linux IPv4 Tweak] MINIMIZE DELAYS FOR INTERACTIVE TRAFFIC
# SO_RCVBUF:
#    ENLARGE SYSTEM SOCKET RECEIVE BUFFER
# SO_SNDBUF:
#    ENLARGE SYSTEM SOCKET SEND BUFFER

   socket options = TCP_NODELAY IPTOS_LOWDELAY SO_RCVBUF=131072 SO_SNDBUF=131072

# SMBWriteX CALLS GREATER THAN "min receivefile size" WILL BE
# PASSED DIRECTLY TO KERNEL recvfile/splice SYSTEM CALL.
# TO ENABLE POSIX LARGE WRITE SUPPORT (SMB/CIFS WRITES UP TO 16MB),
# THIS OPTION MUST BE NONZERO.
# THIS OPTION WILL HAVE NO EFFECT IF SET ON A SMB SIGNED CONNECTION.
# MAX VALUE = 128k

   min receivefile size = 16384

# USE THE MORE EFFICIENT sendfile() SYSTEM CALL FOR EXCLUSIVELY
# OPLOCKED FILES.
# NOTE: ONLY FOR CLIENTS HIGHER THAN WINDOWS 98/Me

   use sendfile = Yes

# READ FROM FILE ASYNCHRONOUSLY WHEN SIZE OF REQUEST IS BIGGER
# THAN THIS VALUE.
# NOTE: SAMBA MUST BE BUILT WITH ASYNCHRONOUS I/O SUPPORT

   aio read size = 16384

# WRITE TO FILE ASYNCHRONOUSLY WHEN SIZE OF REQUEST IS BIGGER
# THAN THIS VALUE
# NOTE: SAMBA MUST BE BUILT WITH ASYNCHRONOUS I/O SUPPORT

   aio write size = 16384

credit: https://eggplant.pro/blog/faster-samba-smb-cifs-share-performance/

However, in this line

socket options = TCP_NODELAY IPTOS_LOWDELAY SO_RCVBUF=131072 SO_SNDBUF=131072

Should change to

socket options = TCP_NODELAY IPTOS_LOWDELAY

In order to let Samba handle buffer size automatically. Should do TCP cache Tweak instead.

Installing Low latency kernel and DeaDBeef

As for HTPC I’m choosing Mint 18.1 XFCE. Mint coming with VLC so I don’t need to install it.

What I’m done were

1. Installing DeaDBeef as Music Player

sudo add-apt-repository ppa:starws-box/deadbeef-player

sudo apt-get update

sudo apt-get install deadbeef

2. Installing low latency kernel

You could check kernel version and type by this command

uname -a

If It’s low latency or real time kernel, you don’t need to install low-latency kernel

To install low latency kernel, use this command

sudo apt-get install linux-lowlatency

If you experience buggy or strange behavior after install low latency kernel, you should remove the kernel by this command.

sudo apt-get remove linux-lowlatency

Screenshot_2017-02-21_01-03-11.png

Tearing when playback video or scrolling webpage (AMD Radeon)

It’s seem that default XORG config in Ubuntu/Mint cause the problem.

My HTPC using AMD APU. This is how I fixed it.

Check the location of Xorg config’s folder it’s either at

/usr/share/X11/xorg.conf.d/

or

/etc/X11/xorg.conf.d/

Create file name “20-radeon.conf” in the folder and put there line below in the file and save then reboot the system.

Section "Device"
	Identifier "Radeon"
	Driver "radeon"
		Option "TearFree" "true"
		Option "DRI" "3"
		Option "AccelMethod" "glamor"
		Option "TripleBuffer" "true"
		Option "MigrationHeuristic" "greedy"
		Option "ColorTiling" "on"
		Option "ColorTiling2D" "on"
EndSection

Note

  • Option “ShadowPrimary” “on” requires “AccelMethod” “glamor”. It increase 2D performance while decrease 3D and Video performance.
  • Option “EXAVSync” “yes” requires “AccelMethod” “exa”. It’s using in older card (older than R600 (Radeon HD2000 series)). Don’t use If your card is newer.
  • Option “ColorTiling2D” “on” only available on R600 (Radeon HD2000 series) and newer.
  • Option “MigrationHeuristic” “greedy” Using if has 2D performance issue like slow scrolling in a terminal or web browser (Both AMD/Intel).

References

https://wiki.archlinux.org/index.php/ATI

https://www.x.org/archive/X11R7.5/doc/man/man4/radeon.4.html

https://www.x.org/wiki/RadeonFeature/

My new little journey in Linux World

Recently, I trying to convert from Windows to Linux. Well, have almost zero experience. TT^TT

I decided to start with Ubuntu and Mint. I like XFCE interface the most so I install Mint XFCE 18.1 and might try Xbuntu 16.10 later.

As some web apps I using are develop on Silverlight, working PC is still Windows. Using VirtualBox is beating the purpose to switch to Linux and Wine is somewhat not 100% compatible. Therefore, my Linux PCs was for either Torrent download or HTPC.

So I decide to put some problem I encounter in WordPress as for my own references and might benefit other people.

Leaf Audio Amanero Combo 384

This daughter board has very high potential as it support various packages of TCXO. Which means we could upgrade TCXO from generic 2.5ppm SMD to ultra precise 0.1ppm TCXO. Amanero.png

Originally, the daughter board was designed to using with Leaf Audio DSD1796/1792 DAC. Using with other DAC is possible but rewiring is needed

Leaf Audio DSD1796
TB2Fig6nVXXXXXOXpXXXXXXXXXX_!!70273426.jpg

TB2ZMOEgVXXXXb6XXXXXXXXXXXX_!!70273426.jpg

SMPCB 20 pin XMOS daughter board (Pin 20 as F0)

TB26t5mXZgd61BjSZFjXXbXspXa_!!201755970.jpg_600x600.jpg

xu208.PNG

This daughter board using in SMPCB AK4495 DAC and AK4118 receiver board. Probably not compatible with other DAC as Pin 8 is NC but in other DAC it has to be Ground.

SMPCB AK4118 receiver board
TB2b8TKlXXXXXXqXXXXXXXXXXXX_!!201755970.jpg_600x600.jpg

SMPCB AK4495 DAC

smpcb dac.PNG

Pin information

  1. Not Connected
  2. Not Connected
  3. DATA
  4. Base Clock (BCLK)
  5. FS CLK, LR CLK
  6. Main Clock (MCLK)
  7. DSD On (0=PCM, 1=DSD)
  8. Not Connected
  9. Power out 3.3V max ? mA
  10. Power out 3.3V max ? mA
  11. Mute
  12. Not Connected
  13. Ground
  14. Ground
  15. Ground
  16. Not Connected
  17. Not Connected
  18. F2
  19. F1
  20. F0

DSD On and F0-F2 sampling rate table

smpcb.PNG