27 Ekim 2022 Perşembe

sockperf komutu

Örnek
Şöyle yaparız
on the server: sockperf server -i 224.4.4.4 -p 1234
on the client: sockperf ping-pong -i 224.4.4.4 -p 1234

26 Ekim 2022 Çarşamba

Ethernet Bonding

Giriş
Bazı bonding modları şöyle
broadcast
balance-alb
balance-xor
balance-rr

broadcast
Açıklaması şöyle
broadcast mode largely exists just to provide a bonding mode that can handle the loss of a bound interface without any disruption whatsoever (active-backup mode, which provides similar fault-tolerance, will show a small latency spike if the active bound interface goes down because it has to reroute traffic and force updates of external ARP caches). It’s realistically only usable on layer 2 point-to-point links between systems that are both using the bonding driver (possibly even the same mode), and gives you no performance benefits.
balance-rr
Açıklaması şöyle
balance-rr mode is instead designed to have minimal overhead, irrespective of whatever other constraints exist, and it actually does translate to evenly balancing the load across all bound interfaces. The problem is that if there is more than one hop below layer 3, this mode cannot provide packet ordering guarantees, which in turn causes all kinds of issues with congestion control algorithms, functionally capping effective bandwidth. It is also, in practice, only usable on layer 2 point-to-point links between systems that are both using the bonding driver.
Bir soru ve cevap şöyle
Q : Linux is capable of bonding NICs together. The interesting policy for this is Round-robin, which alternates outgoing packets between each NIC.

A : For the single flow, any bandwidth gain in the direction from the switch to the client is highly unlikely.

...

So any bandwidth gain for single flow is HIGHLY unlikely. You may see some gain using multiple flows, depending on hashing policy the switch uses and the server configured (see xmit_hash_policy for what's available, you will need policy policy which includes L4 information to gain anything between two specific hosts).
balance-alb
Açıklaması şöyle
Assuming your switch plays nice with it, you probably want balance-alb mode, as it will give you the best overall link utilization spread across the links. However, some network hardware does not like how that mode handles receive load balancing, in which case you almost certainly instead want 802.3ad mode (if your switch supports it, and all the bound interfaces are connected to the same switch) or balance-xor (does the same thing, but the switch has to infer what’s going on, so does not work as well in all cases).

20 Ekim 2022 Perşembe

Mac OS X brew komutu

Resmi olmayan package manager. Eskiden Mac OS  için paket yöneticisi olarak MacPorts veya Fink kullanılırdı. brew kullanmak daha kolay

Brew Kurulumu
Şöyle yaparız
/bin/bash \
  -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew kurulduktan sonra path'e eklemek lazım.  "~/.zshrc" dosyasında şöyle yaparız
export PATH="$PATH:/opt/homebrew/bin/"
install seçeneği
Yeni paketi kurar
Örnek
brew install gnuplot
services seçeneği
Örnek
Şöyle yaparız
> brew install redis
> brew services start redis

tap seçeneği
Örnek
Şöyle yaparız
brew tap hazelcast/hz

brew install hazelcast@5.2.1


13 Ekim 2022 Perşembe

supervisor

Kurulum
Kurmak için şöyle yaparız
apt-get install -y supervisor
Örnek
Şöyle yaparız. Burada sadece son iki bölüm bizim uygulamamız için gerekli tanımlardır
[unix_http_server]
file=/tmp/supervisor.sock   ; the path to the socket file
;chmod=0700                 ; socket file mode (default 0700)
;chown=nobody:nogroup       ; socket file uid:gid owner
username=admin              ; default is no username (open server)
password=admin              ; default is no password (open server)

[inet_http_server]         ; inet (TCP) server disabled by default
port=127.0.0.1:9001       ; ip_address:port specifier, *:port for all iface
username=admin              ; default is no username (open server)
password=admin               ; default is no password (open server)

[supervisord]
logfile=/tmp/supervisord.log ; main log file; default $CWD/supervisord.log
logfile_maxbytes=50MB        ; max main logfile bytes b4 rotation; default 50MB
logfile_backups=10           ; # of main logfile backups; 0 means none, default 10
loglevel=info                ; log level; default info; others: debug,warn,trace
pidfile=/tmp/supervisord.pid ; supervisord pidfile; default supervisord.pid
nodaemon=true               ; start in foreground if true; default false
minfds=1024                  ; min. avail startup file descriptors; default 1024
minprocs=200                 ; min. avail process descriptors;default 200
;umask=022                   ; process file creation umask; default 022
user=root            ; setuid to this UNIX account at startup; recommended if root

[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface

[supervisorctl]
serverurl=unix:///tmp/supervisor.sock ; use a unix:// URL  for a unix socket
serverurl=http://127.0.0.1:9001 ; use an http:// url to specify an inet socket

[program:customer-service]
command=java -jar /app/customer-service-0.0.1-SNAPSHOT.jar
startsecs=10
directory=/app
stdout_logfile=/app/customer-service.log
stdout_logfile=/app/customer-service.err


[program:lucky-winner-service]
command=java -jar /app/lucky-winner-0.0.1-SNAPSHOT.jar
startsecs=10
directory=/app
stdout_logfile=/app/lucky-winner-service.log
stdout_logfile=/app/lucky-winner-service.err


8 Ekim 2022 Cumartesi

Quick Emulator - QEMU

Giriş
Açıklaması şöyle
QEMU was the brainchild of Fabrice Bellard.
QEMU Nedir
Açıklaması şöyle
a fast full-system emulator translating between pretty much every processor architecture.
Açıklaması şöyle
How emulators worked before QEMU

I first heard of QEMU around 2006. I was into computer architecture from my early days, and most emulators at the time would simply naively translate instructions from into the emulated architecture at runtime.

QEMU, on the other hand, employed a “Tiny Code Generator” to translate instructions through JIT compilation. It wasn’t as fast as running natively, but for a variety of applications it was fast enough and for many use cases it felt like pure miracle. QEMU also had its own emulation for common physical devices you would expect to find, its own disk image format, and much more.



5 Ekim 2022 Çarşamba

ssh-keyscan komutu

Giriş
Açıklaması şöyle
ssh-keyscan is a utility for gathering the public SSH host keys of a number of hosts. It was designed to aid in building and verifying ssh_known_hosts files, the format of which is documented in sshd(8). ssh-keyscan provides a minimal interface suitable for use by shell and perl scripts.
Örnek
Şöyle yaparız
# Delete the entry for the old IP
ssh-keygen -R $OLD_IP

# Add entry for the new IP
ssh-keyscan $NEW_IP >> ~/.ssh/known_hosts
-H seçeneği
Çıktıyı hashed formatta almak için kullanılır
Örnek
Şöyle yaparız
ssh-keyscan -H $NEW_IP >> ~/.ssh/known_hosts


2 Ekim 2022 Pazar

rtcwake komutu - Bilgisayarı Kapatır ve Belirtilen Zamanda Uyandırır

-m seçeneği
mode olarak şunlar kullanılabilir
- standby
- freeze
- mem
- disk
- off
- no : suspend etmez
- on
- disable
- show

Örnek
Şöyle yaparız. Saat 16'da bilgisayarı uyandırır
sudo rtcwake -m no -l -t "$(date -d 'today 16:00:00' '+%s')"
chrontab'da kullanmak için şöyle yaparız
@reboot root /usr/bin/rtcwake -m no -l -t "$(/usr/bin/date -d 'today 16:00:00' '+%s')"
-s seçeneği
Kaç saniye sonra uyandırılacağını belirtir
Örnek
Şöyle yaparız. Saat 23'te suspend eder ve 12 saat sonra uyandırır
0 23 * * *  root /usr/bin/rtcwake -m disk -s 60*60*12