Auteur Sujet: Perfs moisies avec samba  (Lu 8592 fois)

0 Membres et 1 Invité sur ce sujet

renaud07

  • Abonné Orange adsl
  • *
  • Messages: 3 345
Perfs moisies avec samba
« le: 03 décembre 2016 à 18:24:51 »
Bonsoir,

Je me suis monté l'an passé un serveur basse conso avec une CM asrock Q1900-ITX sous debian, et bien que pas très puissant, je suis étonné de la différence de performances entre samba (partages Windows) et NFS.

Avec samba, je ne dépasse pas les 16 Mo/s que ce soit en lecture ou écriture, alors qu'en NFS c'est d'une rapidité, au moins 50 Mo/s en écriture (en augmentation avec le transfert) et en lecture c'est 80 Mo/s.

Le jour et la nuit, littéralement. Alors je sais que le protocole SMB a tendance à être plus pourri que NFS, mais quand même, faire à peine plus que 100 Mb/s je trouve ça léger. Et sous windows directement c'est encore pire, je me tape des transferts à 8 Mo/s !

J'ai contrôlé les ressources systèmes pendant les transferts et le CPU tout cœur confondu n'est même pas à 50% (aucun cœur n'est utilisé à fond).

Est-il possible d'améliorer ça ou c'est une cause perdue ?

Merci d'avance.


BadMax

  • Client Free adsl
  • Expert
  • *
  • Messages: 3 481
  • Malissard (26)
Perfs moisies avec samba
« Réponse #1 le: 03 décembre 2016 à 19:15:30 »
Déjà ça vient pas du CPU: mon Atom C2550 n'est guère plus performant d'après CPUboss.

Citer
CPU tout cœur confondu n'est même pas à 50% (aucun cœur n'est utilisé à fond)

T'as regardé avec quoi ?

TODO de tests à faire sur le serveur:
 - test d'écriture en local de 1Go: dd if=/dev/zero of=/tmp/test bs=1M count=1024
 - pendant une copie SMB: lances un "iostat 2" et fais-nous un petit top aussi
 - smarctl -a /dev/<disque> (probablement sda ou sdb)
 - hdparm -I /dev/<disque>
 - hdparm -t /dev/<disque>

renaud07

  • Abonné Orange adsl
  • *
  • Messages: 3 345
Perfs moisies avec samba
« Réponse #2 le: 03 décembre 2016 à 22:09:29 »
Pour le cpu j'ai regardé avec htop. Avec top le process smbd occupe 24% du cpu (voir image en PJ).

La commande hdparm -I ne correspond à aucune option, tu voulais savoir quoi exactement ? Pour le reste voici :

root@serveur:~# dd if=/dev/zero of=/data/test bs=1M count=1024
1024+0 enregistrements lus
1024+0 enregistrements écrits
1073741824 octets (1,1 GB) copiés, 7,73777 s, 139 MB/s
root@serveur:~#

Le disque est plein à 80% donc c'est à mon avis normal que le test d'écriture sois un peu limite.


root@serveur:~# iostat 2
Linux 3.16.0-4-amd64 (serveur) 03/12/2016 _x86_64_ (4 CPU)

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           0,32    0,00    0,09    0,07    0,00   99,51

Device:            tps    kB_read/s    kB_wrtn/s    kB_read    kB_wrtn
sdb               0,32        24,45        26,56    7039033    7645992
sda               0,51         1,82        25,89     525254    7453364
sdc               0,01         0,12         0,00      33944         12

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           0,38    0,00    1,63    0,00    0,00   97,99

Device:            tps    kB_read/s    kB_wrtn/s    kB_read    kB_wrtn
sdb              31,50      3780,00         0,00       7560          0
sda               0,00         0,00         0,00          0          0
sdc               0,00         0,00         0,00          0          0

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           0,38    0,00    2,42    0,13    0,00   97,07

Device:            tps    kB_read/s    kB_wrtn/s    kB_read    kB_wrtn
sdb              62,00      7558,00         0,00      15116          0
sda               6,00         0,00     12304,00          0      24608
sdc               0,00         0,00         0,00          0          0

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           0,88    0,00    8,04    0,25    0,00   90,83

Device:            tps    kB_read/s    kB_wrtn/s    kB_read    kB_wrtn
sdb             137,50     16400,00         8,00      32800         16
sda               0,00         0,00         0,00          0          0
sdc               0,00         0,00         0,00          0          0

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           htop0,64    0,00    6,43    0,00    0,00   92,93

Device:            tps    kB_read/s    kB_wrtn/s    kB_read    kB_wrtn
sdb             135,50     16336,00         0,00      32672          0
sda               0,00         0,00         0,00          0          0
sdc               0,00         0,00         0,00          0          0

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           0,38    0,00    8,44    0,00    0,00   91,18

Device:            tps    kB_read/s    kB_wrtn/s    kB_read    kB_wrtn
sdb             138,50     16596,00         0,00      33192          0
sda               0,00         0,00         0,00          0          0
sdc               0,00         0,00         0,00          0          0

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           0,50    0,00    8,65    0,25    0,00   90,60

Device:            tps    kB_read/s    kB_wrtn/s    kB_read    kB_wrtn
sdb             134,50     16208,00         0,00      32416          0
sda             101,00         0,00       580,00          0       1160
sdc               0,00         0,00         0,00          0          0

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           0,88    0,00    8,43    0,25    0,00   90,44

Device:            tps    kB_read/s    kB_wrtn/s    kB_read    kB_wrtn
sdb             136,50     16336,00         6,00      32672         12
sda               0,00         0,00         0,00          0          0
sdc               0,00         0,00         0,00          0          0

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           0,50    0,00    8,43    0,13    0,00   90,94

Device:            tps    kB_read/s    kB_wrtn/s    kB_read    kB_wrtn
sdb             138,50     16720,00         0,00      33440          0
sda               0,50         0,00         2,00          0          4
sdc               0,00         0,00         0,00          0          0

root@serveur:~# hdparm -t /dev/sdb

/dev/sdb:
 Timing buffered disk reads: 524 MB in  3.01 seconds = 174.27 MB/sec
root@serveur:~# smarctl -a /dev/sda
-bash: smarctl : commande introuvable
root@serveur:~# smartctl -a /dev/sdb
smartctl 6.4 2014-10-07 r4002 [x86_64-linux-3.16.0-4-amd64] (local build)
Copyright (C) 2002-14, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Model Family:     Seagate Barracuda 7200.14 (AF)
Device Model:     ST1000DM003-1CH162
Serial Number:    Z1DB47W0
LU WWN Device Id: 5 000c50 066ab9ad2
Firmware Version: CC47
User Capacity:    1 000 204 886 016 bytes [1,00 TB]
Sector Sizes:     512 bytes logical, 4096 bytes physical
Rotation Rate:    7200 rpm
Form Factor:      3.5 inches
Device is:        In smartctl database [for details use: -P show]
ATA Version is:   ACS-2, ACS-3 T13/2161-D revision 3b
SATA Version is:  SATA 3.1, 6.0 Gb/s (current: 3.0 Gb/s)
Local Time is:    Sat Dec  3 22:03:09 2016 CET
SMART support is: Available - device has SMART capability.
SMART support is: Enabled

=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED

General SMART Values:
Offline data collection status:  (0x82) Offline data collection activity
was completed without error.Mes disques mon sains, pas de secteurs défectueux ou autre.
Auto Offline Data Collection: Enabled.
Self-test execution status:      (   0) The previous self-test routine completed
without error or no self-test has ever
been run.
Total time to complete Offline
data collection: (  584) seconds.
Offline data collection
capabilities: (0x7b) SMART execute Offline immediate.
Auto Offline data collection on/off support.
Suspend Offline collection upon new
command.
Offline surface scan supported.
Self-test supported.
Conveyance Self-test supported.
Selective Self-test supported.
SMART capabilities:            (0x0003) Saves SMART data before entering
power-saving mode.
Supports SMART auto save timer.
Error logging capability:        (0x01) Error logging supported.
General Purpose Logging supported.
Short self-test routine
recommended polling time: (   1) minutes.
Extended self-test routine
recommended polling time: ( 110) minutes.
Conveyance self-test routine
recommended polling time: (   2) minutes.
SCT capabilities:        (0x3085) SCT Status supported.

SMART Attributes Data Structure revision number: 10
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
  1 Raw_Read_Error_Rate     0x000f   117   099   006    Pre-fail  Always       -       141456248
  3 Spin_Up_Time            0x0003   097   097   000    Pre-fail  Always       -       0
  4 Start_Stop_Count        0x0032   100   100   020    Old_age   Always       -       204
  5 Reallocated_Sector_Ct   0x0033   100   100   010    Pre-fail  Always       -       0
  7 Seek_Error_Rate         0x000f   066   060   030    Pre-fail  Always       -       4343982
  9 Power_On_Hours          0x0032   094   094   000    Old_age   Always       -       5502
 10 Spin_Retry_Count        0x0013   100   100   097    Pre-fail  Always       -       0
 12 Power_Cycle_Count       0x0032   100   100   020    Old_age   Always       -       212
183 Runtime_Bad_Block       0x0032   098   098   000    Old_age   Always       -       2
184 End-to-End_Error        0x0032   100   100   099    Old_age   Always       -       0
187 Reported_Uncorrect      0x0032   100   100   000    Old_age   Always       -       0
188 Command_Timeout         0x0032   100   100   000    Old_age   Always       -       0 0 0
189 High_Fly_Writes         0x003a   100   100   000    Old_age   Always       -       0
190 Airflow_Temperature_Cel 0x0022   069   051   045    Old_age   Always       -       31 (Min/Max 13/35)
191 G-Sense_Error_Rate      0x0032   100   100   000    Old_age   Always       -       0
192 Power-Off_Retract_Count 0x0032   100   100   000    Old_age   Always       -       77
193 Load_Cycle_Count        0x0032   100   100   000    Old_age   Always       -       217
194 Temperature_Celsius     0x0022   031   049   000    Old_age   Always       -       31 (0 10 0 0 0)
197 Current_Pending_Sector  0x0012   100   100   000    Old_age   Always       -       0
198 Offline_Uncorrectable   0x0010   100   100   000    Old_age   Offline      -       0
199 UDMA_CRC_Error_Count    0x003e   200   200   000   Old_age   Always       -       0
240 Head_Flying_Hours       0x0000   100   253   000    Old_age   Offline      -       5497h+17m+19.151s
241 Total_LBAs_Written      0x0000   100   253   000    Old_age   Offline      -       2177947818
242 Total_LBAs_Read         0x0000   100   253   000    Old_age   Offline      -       786819387

SMART Error Log Version: 1
No Errors Logged

SMART Self-test log structure revision number 1
No self-tests have been logged.  [To run self-tests, use: smartctl -t]

SMART Selective self-test log data structure revision number 1
 SPAN  MIN_LBA  MAX_LBA  CURRENT_TEST_STATUS
    1        0        0  Not_testing
    2        0        0  Not_testing
    3        0        0  Not_testing
    4        0        0  Not_testing
    5        0        0  Not_testing
Selective self-test flags (0x0):
  After scanning selected spans, do NOT read-scan remainder of disk.
If Selective self-test is pending on power-up, resume after 0 minute delay.

root@serveur:~# hdparm -t /dev/sdb
/dev/sdb:
 Timing buffered disk reads: 524 MB in  3.01 seconds = 174.27 MB/sec



BadMax

  • Client Free adsl
  • Expert
  • *
  • Messages: 3 481
  • Malissard (26)
Perfs moisies avec samba
« Réponse #3 le: 03 décembre 2016 à 23:10:33 »
OK donc RAS côté disque&CPU.

En NFS tu devrais tenir le Gb.
On continue les checks:
 - lspci | grep Ether
 - ethtool -k Eth0
 - ifconfig eth0
 - netstat -s

Enfin on va vérifier ta config Samba:
 - testparm -v

renaud07

  • Abonné Orange adsl
  • *
  • Messages: 3 345
Perfs moisies avec samba
« Réponse #4 le: 04 décembre 2016 à 00:23:21 »
root@serveur:~# lspci | grep Ether
03:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 11)

root@serveur:~# ethtool -k eth0
Features for eth0:
rx-checksumming: on
tx-checksumming: off
tx-checksum-ipv4: off
tx-checksum-ip-generic: off [fixed]
tx-checksum-ipv6: off [fixed]
tx-checksum-fcoe-crc: off [fixed]
tx-checksum-sctp: off [fixed]
scatter-gather: off
tx-scatter-gather: off
tx-scatter-gather-fraglist: off [fixed]EDIT
tcp-segmentation-offload: off
tx-tcp-segmentation: off
tx-tcp-ecn-segmentation: off [fixed]
tx-tcp6-segmentation: off [fixed]
udp-fragmentation-offload: off [fixed]
generic-segmentation-offload: off [requested on]
generic-receive-offload: on
large-receive-offload: off [fixed]
rx-vlan-offload: on
tx-vlan-offload: on
ntuple-filters: off [fixed]
receive-hashing: off [fixed]
highdma: off [fixed]
rx-vlan-filter: off [fixed]
vlan-challenged: off [fixed]
tx-lockless: off [fixed]
netns-local: off [fixed]
tx-gso-robust: off [fixed]
tx-fcoe-segmentation: off [fixed]
tx-gre-segmentation: off [fixed]
tx-ipip-segmentation: off [fixed]
tx-sit-segmentation: off [fixed]
tx-udp_tnl-segmentation: off [fixed]
tx-mpls-segmentation: off [fixed]
fcoe-mtu: off [fixed]
tx-nocache-copy: off
loopback: off [fixed]
rx-fcs: off
rx-all: off
tx-vlan-stag-hw-insert: off [fixed]
rx-vlan-stag-hw-parse: off [fixed]
rx-vlan-stag-filter: off [fixed]
l2-fwd-offload: off [fixed]
busy-poll: off [fixed]

root@serveur:~# ifconfig eth0
eth0      Link encap:Ethernet  HWaddr d0:XX:XX:XX:fe:de 
          inet adr:192.168.1.2  Bcast:192.168.1.255  Masque:255.255.255.0
          adr inet6: fe80::d250:99ff:fe7e:fede/64 Scope:Lien
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:7495585 errors:0 dropped:484 overruns:0 frame:0
          TX packets:7554332 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 lg file transmission:1000
          RX bytes:8303898376 (7.7 GiB)  TX bytes:10202092507 (9.5 GiB)

root@serveur:~# netstat -s
Ip:
    2856215 total packets received
    0 forwarded
    0 incoming packets discarded
    2855835 incoming packets delivered
    7552784 requests sent out
    1 fragments dropped after timeout
    216 reassemblies required
    71 packets reassembled ok
    1 packet reassembles failed
Icmp:
    2059 ICMP messages received
    6 input ICMP message failed.
    Histogramme d'entrée ICMP
        destination unreachable: 1983
        echo requests: 76
    1754 ICMP messages sent
    0 ICMP messages failed
    Histogramme de sortie ICMP
        destination unreachable: 1678
        echo replies: 76
IcmpMsg:
        InType3: 1983
        InType8: 76
        OutType0: 76
        OutType3: 1678
Tcp:
    2850 active connections openings
    964 passive connection openings
    933 failed connection attempts
    62 connection resets received
    8 connections established
    2765558 segments received
    7471877 segments send out
    1583 segments retransmited
    0 bad segments received.
    826 resets sent
Udp:
    78895 packets received
    203 packets to unknown port received.
    301 packet receive errors
    78749 packets sent
    RcvbufErrors: 301
UdpLite:
TcpExt:
    2 invalid SYN cookies received
    163 resets received for embryonic SYN_RECV sockets
    721 TCP sockets finished time wait in fast timer
    2402 delayed acks sent
    279 delayed acks further delayed because of locked socket
    Quick ack mode was activated 240 times
    8 SYNs to LISTEN sockets dropped
    175786 packets directly queued to recvmsg prequeue.
    110668844 bytes directly in process context from backlog
    674095880 bytes directly received in process context from prequeue
    665773 packet headers predicted
    292769 packets header predicted and directly queued to user
    43721 acknowledgments not containing data payload received
    1758195 predicted acknowledgments
    36 times recovered from packet loss by selective acknowledgements
    Detected reordering 183 times using SACK
    Detected reordering 3 times using time stamp
    3 congestion windows fully recovered without slow start
    6 congestion windows partially recovered using Hoe heuristic
    5 congestion windows recovered without slow start by DSACK
    34 congestion windows recovered without slow start after partial ack
    11 timeouts after SACK recovery
    120 fast retransmits
    252 forward retransmits
    1 retransmits in slow start
    699 other TCP timeouts
    TCPLossProbes: 776
    TCPLossProbeRecovery: 197
    1 SACK retransmits failed
    240 DSACKs sent for old packets
    793 DSACKs received
    19 connections reset due to unexpected data
    31 connections reset due to early user close
    6 connections aborted due to timeout
    TCPDSACKIgnoredOld: 10
    TCPDSACKIgnoredNoUndo: 519
    TCPSpuriousRTOs: 2
    TCPSackShiftFallback: 5657
    TCPDeferAcceptDrop: 363
    TCPRetransFail: 13
    TCPRcvCoalesce: 153023
    TCPOFOQueue: 661
    TCPSpuriousRtxHostQueues: 13
    TCPAutoCorking: 216908
    TCPFromZeroWindowAdv: 15
    TCPToZeroWindowAdv: 15
    TCPWantZeroWindowAdv: 64
    TCPSynRetrans: 434
    TCPOrigDataSent: 6868697
IpExt:
    InMcastPkts: 9875
    InBcastPkts: 1586
    OutBcastPkts: 936
    InOctets: 7961336731
    OutOctets: 10100580922
    InMcastOctets: 316000
    InBcastOctets: 325154
    OutBcastOctets: 215036
    InNoECTPkts: 7483098
    InECT0Pkts: 6
    InCEPkts: 1

Au vu des warning, je pense que ma config samba est à optimiser, j'avais testé il y a un moment différents paramètres et je n'y ai pas retouché depuis.

EDIT : Après avoir commenté la ligne des options TCP, ça turbien à 40-50 Mo/s, youpi !  :D  Et il y a peu je suis aussi passé a un switch gigabit, c'est donc pour ça que je ne voyais aucune différence quand j'étais en 100 Mbps.

C'est pas aussi rapide que NFS mais y'a un très net progrès  8)

root@serveur:~# testparm -v
Load smb config files from /etc/samba/smb.conf
Processing section "[partage]"
Processing section "[ftp]"
Processing section "[divers]"
Processing section "[series]"
Processing section "[films]"
Processing section "[musique]"
Processing section "[openradio]"
Loaded services file OK.
WARNING: socket options = TCP_NODELAY IPTOS_LOWDELAY SO_RCVBUF=8192 SO_SNDBUF=8192
This warning is printed because you set one of the
following options: SO_SNDBUF, SO_RCVBUF, SO_SNDLOWAT,
SO_RCVLOWAT
Modern server operating systems are tuned for
high network performance in the majority of situations;
when you set 'socket options' you are overriding those
settings.
Linux in particular has an auto-tuning mechanism for
buffer sizes (SO_SNDBUF, SO_RCVBUF) that will be
disabled if you specify a socket buffer size. This can
potentially cripple your TCP/IP stack.

Getting the 'socket options' correct can make a big
difference to your performance, but getting them wrong
can degrade it by just as much. As with any other low
level setting, if you must make changes to it, make
 small changes and test the effect before making any
large changes.

Server role: ROLE_STANDALONE

BadMax

  • Client Free adsl
  • Expert
  • *
  • Messages: 3 481
  • Malissard (26)
Perfs moisies avec samba
« Réponse #5 le: 04 décembre 2016 à 09:06:37 »
A 50Mo/s, c'est possible qu'un Core sature sinon ça veut dire qu'on peut encore gratter.

SMB est bien plus gourmand en CPU que NFS, le protocole est plus sophistiqué.

Optix

  • AS41114 - Expert OrneTHD
  • Abonné Orne THD
  • *
  • Messages: 4 644
  • WOOHOO !
    • OrneTHD
Perfs moisies avec samba
« Réponse #6 le: 04 décembre 2016 à 09:43:59 »
SO_RCVBUF=8192 SO_SNDBUF=8192

Double ces valeurs, et reboot smbd.

renaud07

  • Abonné Orange adsl
  • *
  • Messages: 3 345
Perfs moisies avec samba
« Réponse #7 le: 04 décembre 2016 à 19:15:44 »
SO_RCVBUF=8192 SO_SNDBUF=8192

Double ces valeurs, et reboot smbd.

Je viens tester : ça redescend à 30 Mo/s.

renaud07

  • Abonné Orange adsl
  • *
  • Messages: 3 345
Perfs moisies avec samba
« Réponse #8 le: 04 décembre 2016 à 19:17:31 »
A 50Mo/s, c'est possible qu'un Core sature sinon ça veut dire qu'on peut encore gratter.

SMB est bien plus gourmand en CPU que NFS, le protocole est plus sophistiqué.

On doit pouvoir encore gratter en effet, les cores ne saturent pas. Après, ce qu'il faut mettre dans la config, à toi de me le dire  ;)

BadMax

  • Client Free adsl
  • Expert
  • *
  • Messages: 3 481
  • Malissard (26)
Perfs moisies avec samba
« Réponse #9 le: 04 décembre 2016 à 20:20:56 »
Essaye ça:
socket options = TCP_NODELAY IPTOS_LOWDELAY SO_RCVBUF=131072 SO_SNDBUF=131072

renaud07

  • Abonné Orange adsl
  • *
  • Messages: 3 345
Perfs moisies avec samba
« Réponse #10 le: 04 décembre 2016 à 21:25:10 »
Ça reste toujours autour de 50 Mo/s (et les cores ne saturent toujours pas). Par contre en NFS j'explose le compteur aujourd'hui : 90 Mo/s (avec un ralentissement sur la fin, mais c'est déjà très bien).


Optix

  • AS41114 - Expert OrneTHD
  • Abonné Orne THD
  • *
  • Messages: 4 644
  • WOOHOO !
    • OrneTHD
Perfs moisies avec samba
« Réponse #11 le: 04 décembre 2016 à 21:42:32 »
Je viens tester : ça redescend à 30 Mo/s.

Mmhhh, je suis septique avec tes options de no/low delay, ça n'incite pas smbd à remplir ses buffers au max.