aMule Forum

English => aMule Help => Topic started by: permalac on April 11, 2023, 10:03:17 PM

Title: Advise on performance tuning amule on raspberry pi 3
Post by: permalac on April 11, 2023, 10:03:17 PM
Hi there,

I used emule , amule , ketamine and others in the past.
Today I'm here because I'm running amule in a raspi and for some reason performance appears to be limited by something I don't understand.

Basic stuff appears to be running well :
- Ed2k : Connected with high ID to eMule Sunrise
- Kad : Connected(OK)

My problem, download flatlines at ~2 MB/s.

I'm trying to attach an image here, but I'm failing at it. I'll see if I can put it as reply to this starting thread.
(http://)

I've added some monitoring with the following script I'm adding at the end.

Second image is from the network interface, where green is what I download and blue is what I upload. You can see a green flatline during last 25 hours.

Third image is my connection estimate, which does not go too high up.




One day statistics output

Code: [Select]
Uptime: 1 Days 03:50 hours
 Transfer
Session UL:DL Ratio (Total): 1 : 11.21 (1 : 2.01)
 Uploads
 Uploaded Data (Session (Total)): 18.463 GB (545.429 GB)
eMule: 14.087 GB
aMule: 4.257 GB
Total Overhead (Packets): 130.51 MB (3.73M)
File Request Overhead (Packets): 95.94 MB (3.10M)
Source Exchange Overhead (Packets): 11 kB (218)
Server Overhead (Packets): 605 kB (7k)
Kad Overhead (Packets): 33.28 MB (613k)
Crypt overhead (UDP): 8.85 MB
Active Uploads: 4
Waiting Uploads: 0
Total successful upload sessions: 826
Total failed upload sessions: 1
Average upload time: 7:45 mins
 Downloads
 Downloaded Data (Session (Total)): 206.911 GB (1.069 TB)
eMule: 131.198 GB
aMule: 72.384 GB
New MLDonkey: 3.107 GB
eMule+: 226.60 MB
Total Overhead (Packets): 16777216.000 TB (673k)
File Request Overhead (Packets): 5.46 MB (104k)
Source Exchange Overhead (Packets): 6 kB (136)
Server Overhead (Packets): 10 kB (264)
Kad Overhead (Packets): 46.40 MB (560k)
Crypt overhead (UDP): 7.87 MB
 Found Sources: 67
Kad: 36 (53.73%)
Passive: 18 (26.87%)
Source Exchange: 6 (8.96%)
Local Server: 6 (8.96%)
Remote Server: 1 (1.49%)
Active Downloads (chunks): 57
 Connection
Average download rate (Session): 2.11 MB/s
Average upload rate (Session): 193.12 kB/s
Max download rate (Session): 3.29 MB/s
Max upload rate (Session): 1.13 MB/s
Reconnects: 0
Time Since First Transfer: 1 Days 03:49 hours
Connected To Server Since: 1 Days 03:49 hours
Active Connections (estimate): 59
Max Connection Limit Reached: 80 : 2023-04-11 19:01:09
Average Connections (estimate): 59.3594
Peak Connections (estimate): 87
 Clients
Total: 72 Known: 67
 eMule: 41 (61.19%)
v0.60d: 13 (31.71%)
v0.60c: 1 (2.44%)
v0.50a: 26 (63.41%)
v0.49c: 1 (2.44%)
 aMule: 25 (37.31%)
 Version
v2.4.0: 1 (4.00%)
v2.3.3: 7 (28.00%)
v2.3.2: 3 (12.00%)
v2.3.1: 14 (56.00%)
 Operating System
Linux: 24 (96.00%)
Not Received: 1 (4.00%)
 New MLDonkey: 1 (1.49%)
 Version
v3.1.6: 1 (100.00%)
 Operating System
Not Received: 1 (100.00%)
Unknown: 5
Filtered: 0
Banned: 7
 Servers
Working Servers: 7
Failed Servers: 0
Total: 7
Deleted Servers: 6
Filtered Servers: 0
Users on Working Servers: 98100
Files on Working Servers: 51633977
Total Users: 98100
Total Files: 51633977
Server Occupation: 6.06%
 Shared Files
Number of Shared Files: 886
Total size of Shared Files: 1.059 TB
Average file size: 1.224 GB



The setup

Code: [Select]
root@amule:~# r=$(awk '/^Revision/ { print $3 }' /proc/cpuinfo) \
&& curl -L https://perturb.org/rpi?rev=$r
Revision: a020d3
Model   : 3 Model B+
Memory  : 1 GB
Overvolt: No
Released: Q1 2018
Notes   : (Mfg by Sony)

root@amule:~#

Code: [Select]
$ sudo su -
root@amule:~# lsb_release -a
No LSB modules are available.
Distributor ID: Raspbian
Description:    Raspbian GNU/Linux 11 (bullseye)
Release:        11
Codename:       bullseye

Code: [Select]
root@amule:~# free -m
               total        used        free      shared  buff/cache   available
Mem:             921         262          42           1         616         592
Swap:           2047         220        1827

Code: [Select]
root@amule:~# df -HPT
Filesystem     Type      Size  Used Avail Use% Mounted on
/dev/root      ext4       63G  8.0G   53G  14% /
devtmpfs       devtmpfs  349M     0  349M   0% /dev
tmpfs          tmpfs     484M     0  484M   0% /dev/shm
tmpfs          tmpfs     194M  2.5M  191M   2% /run
tmpfs          tmpfs     5.3M  4.1k  5.3M   1% /run/lock
/dev/mmcblk0p1 vfat      268M   53M  215M  20% /boot
/dev/sdb1      ext4      8.0T  684G  6.9T  10% /srv/DATA
tmpfs          tmpfs      97M   25k   97M   1% /run/user/1000
/dev/sda1      ext4      157G   84G   66G  57% /media/pi/DATA
root@amule:~#


Then the config

First the pieces I believe are relevant:

Code: [Select]
QueueSizePref=500
MaxUpload=7500
MaxDownload=8500
SlotAllocation=300
Autoconnect=1
MaxSourcesPerFile=3
MaxConnections=1000
MaxConnectionsPerFiveSeconds=10
FileBufferSizePref=16


Then the full file just in case I missed something relevant.

Code: [Select]
$ cat .aMule/amule.conf
[eMule]
AppVersion=2.3.3
Nick=REDACTED
QueueSizePref=500
MaxUpload=7500
MaxDownload=8500
SlotAllocation=300
Port=4662
UDPPort=4672
UDPEnable=1
Address=
Autoconnect=1
MaxSourcesPerFile=3
MaxConnections=1000
MaxConnectionsPerFiveSeconds=10
RemoveDeadServer=1
DeadServerRetry=3
ServerKeepAliveTimeout=0
Reconnect=1
Scoresystem=1
Serverlist=1
AddServerListFromServer=0
AddServerListFromClient=0
SafeServerConnect=0
AutoConnectStaticOnly=0
UPnPEnabled=0
UPnPTCPPort=50000
SmartIdCheck=1
ConnectToKad=1
ConnectToED2K=1
TempDir=/srv/DATA/Temp
IncomingDir=/srv/DATA/Incoming
ICH=1
AICHTrust=0
CheckDiskspace=1
MinFreeDiskSpace=1000
AddNewFilesPaused=1
PreviewPrio=0
ManualHighPrio=0
StartNextFile=1
StartNextFileSameCat=0
StartNextFileAlpha=0
FileBufferSizePref=16
DAPPref=1
UAPPref=1
AllocateFullFile=0
OSDirectory=/home/pi/.aMule/
OnlineSignature=0
OnlineSignatureUpdate=5
EnableTrayIcon=0
MinToTray=0
Notifications=0
ConfirmExit=1
StartupMinimized=0
3DDepth=5
ToolTipDelay=1
ShowOverhead=0
ShowInfoOnCatTabs=1
VerticalToolbar=0
GeoIPEnabled=0
ShowVersionOnTitle=0
VideoPlayer=
StatGraphsInterval=3
statsInterval=30
DownloadCapacity=100
UploadCapacity=100
StatsAverageMinutes=5
VariousStatisticsMaxValue=100
SeeShare=2
FilterLanIPs=1
ParanoidFiltering=1
IPFilterAutoLoad=1
IPFilterURL=
FilterLevel=127
IPFilterSystem=0
FilterMessages=1
FilterAllMessages=0
MessagesFromFriendsOnly=0
MessageFromValidSourcesOnly=1
FilterWordMessages=0
MessageFilter=
ShowMessagesInLog=1
FilterComments=0
CommentFilter=
ShareHiddenFiles=1
AutoSortDownloads=0
NewVersionCheck=0
AdvancedSpamFilter=1
MessageUseCaptchas=1
Language=
SplitterbarPosition=75
YourHostname=
DateTimeFormat=%A, %x, %X
AllcatType=0
ShowAllNotCats=0
SmartIdState=1
DropSlowSources=0
KadNodesUrl=http://upd.emule-security.org/nodes.dat
Ed2kServersUrl=http://peerates.net/servers.php
ShowRatesOnTitle=0
GeoLiteCountryUpdateUrl=http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz
StatsServerName=Shorty's ED2K stats
StatsServerURL=http://ed2k.shortypower.dyndns.org/?hash=
CreateSparseFiles=1
StatColor0=4194304
StatColor1=16761024
StatColor2=8454016
StatColor3=53760
StatColor4=32768
StatColor5=8421631
StatColor6=200
StatColor7=140
StatColor8=16750230
StatColor9=12583104
StatColor10=8454143
StatColor11=0
StatColor12=8454016
StatColor13=53760
StatColor14=32768
TableOrderingServer=N:0:0
TableWidthsServer=N:150,A:140,P:25,D:150,p:25,U:40,F:45,r:60,f:40,S:40,V:80
TableOrderingDownload=s:0:0,a:0:0
TableWidthsDownload=a:30,N:260,Z:60,T:65,C:65,S:65,P:170,u:50,p:55,s:70,r:110,c:220,R:220
TableOrderingSources=N:0:0
TableWidthsSources=N:260,D:65,S:65,U:65,P:170,V:50,q:55,O:110,F:200,R:200,m:100
TableOrderingShared=N:0:0
TableWidthsShared=N:250,Z:100,Y:50,p:70,I:220,Q:100,A:100,T:120,R:100,P:120,C:120,D:220
TableOrderingPeers=N:0:0
TableWidthsPeers=N:260,D:65,S:65,U:65,s:65,A:170,V:50,Q:70,q:70,O:110,f:200,m:100
[Browser]
OpenPageInTab=1
CustomBrowserString=
[Proxy]
ProxyEnableProxy=0
ProxyType=0
ProxyName=
ProxyPort=1080
ProxyEnablePassword=0
ProxyUser=
ProxyPassword=
[ExternalConnect]
UseSrcSeeds=0
AcceptExternalConnections=1
ECAddress=0.0.0.0
ECPort=4712
ECPassword=REDACTED
UPnPECEnabled=0
ShowProgressBar=1
ShowPercent=1
UseSecIdent=1
IpFilterClients=1
IpFilterServers=1
TransmitOnlyUploadingClients=0
[WebServer]
Enabled=1
Password=REDACTED
PasswordLow=
Port=8080
WebUPnPTCPPort=50001
UPnPWebServerEnabled=0
UseGzip=1
UseLowRightsUser=0
PageRefreshTime=120
Template=default
Path=amuleweb
[GUI]
HideOnClose=0
[GUI/TransferWnd]
Splitter=567
ShowClientList=1
[Razor_Preferences]
FastED2KLinksHandler=1
MAIN_X_POS=2520
MAIN_Y_POS=25
MAIN_X_SIZE=1280
MAIN_Y_SIZE=988
Maximized=1
SRV_SPLITTER_POS=463
[SkinGUIOptions]
Skin=
[Statistics]
MaxClientVersions=0
[Obfuscation]
IsClientCryptLayerSupported=1
IsCryptLayerRequested=1
IsClientCryptLayerRequired=0
CryptoPaddingLenght=254
CryptoKadUDPKey=981198032
[PowerManagement]
PreventSleepWhileDownloading=0
[UserEvents]
[UserEvents/DownloadCompleted]
CoreEnabled=0
CoreCommand=
GUIEnabled=0
GUICommand=
[UserEvents/NewChatSession]
CoreEnabled=0
CoreCommand=
GUIEnabled=0
GUICommand=
[UserEvents/OutOfDiskSpace]
CoreEnabled=0
CoreCommand=
GUIEnabled=0
GUICommand=
[UserEvents/ErrorOnCompletion]
CoreEnabled=0
CoreCommand=
GUIEnabled=0
GUICommand=
[HTTPDownload]
URL_1=
URL_2=http://shortypower.org/server.met
URL_3=http://www.server-list.info
pi@amule:~ $



Script used with check_mk to create the graphs from above.


Code: [Select]
$ cat /usr/lib/check_mk_agent/local/60/amule_stats.sh
#!/bin/bash

# Retrieve the output of the amulecmd command
amule_stats_output="$(amulecmd --password=REDACTED --command="statistics")"

# Function to extract values from the amule_stats_output
get_stat_value() {
  local stat_name="$1"
  echo "$amule_stats_output" | grep -E -o "${stat_name}[: ].*" | sed -E "s/${stat_name}[: ]+(.*)/\1/"
}

# Function to convert time to minutes
convert_time_to_minutes() {
  local time_string="$1"
  local days hours minutes

  days=$(echo "$time_string" | grep -Eo '[0-9]+ Days' | grep -Eo '[0-9]+')
  hours=$(echo "$time_string" | grep -Eo '[0-9]+:' | grep -Eo '[0-9]+')
  minutes=$(echo "$time_string" | grep -Eo ':[0-9]+' | grep -Eo '[0-9]+')

  days=${days:-0}
  hours=${hours:-0}
  minutes=${minutes:-0}

  # Combine days, hours, and minutes into total minutes
  echo $((days * 24 * 60 + hours * 60 + minutes))
}

# Function to convert size to GB
convert_size_to_gb() {
  local size_string="$1"
  local size=$(echo "$size_string" | grep -Eo "[0-9.]+")
  local unit=$(echo "$size_string" | grep -Eo "[A-Za-z]+")

  if [[ $unit == "MB" ]]; then
    size=$(echo "scale=2; $size / 1024" | bc)
  elif [[ $unit == "kB" ]]; then
    size=$(echo "scale=2; $size / 1024 / 1024" | bc)
  fi

  echo "${size%%.*}"
}

convert_to_kbps() {
  local input_string="$1"
  local value unit

  value=$(echo "$input_string" | grep -Eo '[0-9.]+')
  unit=$(echo "$input_string" | grep -Eo '[kM]?B/s')

  case "$unit" in
    "B/s")
      echo "$(bc -l <<< "scale=2; $value / 1024")"
      ;;
    "kB/s")
      echo "$value"
      ;;
    "MB/s")
      echo "$(bc -l <<< "scale=2; $value * 1024")"
      ;;
    *)
      echo "Invalid unit"
      ;;
  esac
}


# Define check_mk service names
services=(
  "uptime"
  "ul_dl_ratio"
  "uploaded_data"
  "downloaded_data"
  "average_download_rate"
  "average_upload_rate"
  "max_download_rate"
  "max_upload_rate"
  "working_servers"
  "shared_files"
  "active_uploads"
  "waiting_uploads"
  "successful_upload_sessions"
  "failed_upload_sessions"
  "active_downloads"
  "reconnects"
  "time_since_first_transfer"
  "connected_to_server_since"
  "active_connections_estimate"
  "max_connection_limit_reached"
  "average_connections_estimate"
  "peak_connections_estimate"
)

# Define stat_name patterns to extract values from the output
stat_patterns=(
  "Uptime"
  "Session UL:DL Ratio"
  "Uploaded Data \(Session"
  "Downloaded Data \(Session"
  "Average download rate \(Session\)"
  "Average upload rate \(Session\)"
  "Max download rate \(Session\)"
  "Max upload rate \(Session\)"
  "Working Servers"
  "Number of Shared Files"
  "Active Uploads"
  "Waiting Uploads"
  "Total successful upload sessions"
  "Total failed upload sessions"
  "Active Downloads"
  "Reconnects"
  "Time Since First Transfer"
  "Connected To Server Since"
  "Active Connections \(estimate\)"
  "Max Connection Limit Reached"
  "Average Connections \(estimate\)"
  "Peak Connections \(estimate\)"
)

# Iterate over services and patterns
for i in "${!services[@]}"; do
  service_name="${services[i]}"
  stat_pattern="${stat_patterns[i]}"
  stat_value="$(get_stat_value "$stat_pattern")"

  # Remove any newline characters from the extracted value
  stat_value_cleaned="$(echo "$stat_value" | tr -d '\n')"

  # Check if the service needs to be formatted differently
  case "$service_name" in
    uptime|time_since_first_transfer|connected_to_server_since)
      formatted_value=$(convert_time_to_minutes "$stat_value_cleaned")
      ;;
    #average_download_rate|average_upload_rate|max_download_rate|max_upload_rate)
    #  formatted_value=$(echo "$stat_value_cleaned" | sed 's/[^0-9.]*//g') # Remove unit
    #  ;;
    average_download_rate|average_upload_rate|max_download_rate|max_upload_rate)
      formatted_value=$(convert_to_kbps "$stat_value_cleaned")
      ;;
    uploaded_data|downloaded_data|total_size_of_shared_files|average_file_size)
      formatted_value=$(convert_size_to_gb "$stat_value_cleaned")
      ;;
    active_downloads)
      formatted_value=$(echo $stat_value_cleaned | sed -e 's/.*(.*): //g')
      ;;
    *)
      formatted_value="$stat_value_cleaned"
      ;;
  esac

  # Set the status to 0 (OK)
  status=0

  # Set the metric value
  #str="${str// /_}"
  metric_value="${service_name}=${formatted_value}"

  # Print the result in check_mk format
  echo "$status \"aMule_${service_name}\" ${metric_value} ${service_name// /_}: ${formatted_value// /_}"
done

pi@amule:~/.aMule $