@kai_infra | IT Infrastructure Engineer (@sideb_01) header
@kai_infra | IT Infrastructure Engineer (@sideb_01) profile picture

IT Infrastructure Engineer 🇯🇵 Linux | Oracle | Virtualization | Storage | Apache/Tomcat | Cloud Sharing Linux internals, performance & troubleshooting tips in

東京
Joined May 2022
Photo by @kai_infra | IT Infrastructure Engineer (@sideb_01)Photo by @kai_infra | IT Infrastructure Engineer (@sideb_01)Photo by @kai_infra | IT Infrastructure Engineer (@sideb_01)Photo by @kai_infra | IT Infrastructure Engineer (@sideb_01)Photo by @kai_infra | IT Infrastructure Engineer (@sideb_01)Photo by @kai_infra | IT Infrastructure Engineer (@sideb_01)Photo by @kai_infra | IT Infrastructure Engineer (@sideb_01)Photo by @kai_infra | IT Infrastructure Engineer (@sideb_01)Photo by @kai_infra | IT Infrastructure Engineer (@sideb_01)Photo by @kai_infra | IT Infrastructure Engineer (@sideb_01)
SIerで働いているITインフラエンジニアです。 Linux / ITインフラを「図解」で発信しています。 主なテーマは、 Linux / CPU / Memory / I/O / Network / DB / Middleware / Virtualization。 トラブルシューティングや性能解析など、現場で役立つ知識を中心にまとめています。 「知っている」から「説明できる」へ。 皆さんと一緒に楽しくスキルアップしていけたら嬉しいです! 📝 Blog eeengineer.com/ 📚 Kindle|Linux技術書 amazon.co.jp/stores/author/B… ✅ Habicheck|習慣管理アプリ habicheck.eeengineer.com/ #Linux #インフラエンジニア #Troubleshooting
🤖 Made with AI
2
6
1
78
3,571
有益な投稿ですね! cronはシンプルな反面、意外な落とし穴がありますよね。 ちなみに以前、バックアップしたcron定義をcp -pで復元した際、変更が反映されずcron処理が動かないことがありました。 mtimeが保持されるため、cronが変更を検知できないケースもあるので注意が必要ですね。
手動で実行すると動くのに、cronに登録すると動かない。 その原因の多くは、40年以上前から変わらないcronの仕様にある。 ■ cronがハマりやすい3つの理由 1. 環境変数がほぼ空 PATHは /usr/bin:/bin 程度しか通っていないことが多く、.bashrc も読み込まれない → コマンドはフルパスで書く(例:/usr/local/bin/php) 2. 「%」が改行として扱われる date +%Y%m%d をそのまま書くと途中で切れてしまう → \% とエスケープする 3. エラーがどこにも表示されない 出力はメールで送られる設定になっていることが多く、気付かないまま失敗し続ける → >> /var/log/batch.log 2>&1 で必ずログに残す 最近はsystemdタイマーやクラウドのスケジューラーもあるが、既存のサーバーではcronが現役のことがほとんど。 仕組みを知っておくと、調査の時間が大きく変わる。 「手動では動く」は、cronでは動作確認にならない。 #cron #Linux #サーバー運用
1
2
9
1,305
What happens when a Linux server accepts a TCP connection? socket() → bind() → listen() → accept() Meanwhile, the kernel handles: • SYN → SYN-ACK → ACK • SYN Queue → Accept Queue accept() retrieves an established connection. More👇 amazon.com/dp/B0HR8MF187 #Linux #NW
Does send() mean data has been sent over the network? Not necessarily ! 1. Data enters the kernel's socket buffer 2. TCP/IP processing continues 3. The NIC transmits the packets send() returning doesn't guarantee delivery More in my book👇 amazon.com/dp/B0HR8MF187 #Linux #TCP
3
26
555
Does send() mean data has been sent over the network? Not necessarily ! 1. Data enters the kernel's socket buffer 2. TCP/IP processing continues 3. The NIC transmits the packets send() returning doesn't guarantee delivery More in my book👇 amazon.com/dp/B0HR8MF187 #Linux #TCP
What happens after an app sends data on Linux? Application → TCP/IP → qdisc → Driver → TX Ring → NIC qdisc queues and schedules packets, controls bandwidth, and may drop packets when queues fill. More details👇 eeengineer.com/en/linux-netw… #Linux #Networking #TCP
1
20
1,279
Netflixでは、サーバのCPU使用率が60%程度になるようにオートスケーリングの設定を入れてるとのこと。
Brendan Gregg氏が紹介している「パフォーマンスチューニングの7原則」 ① するな ② 二度するな ③ 減らせ ④ 先に延ばせ ⑤ 見られていないときにせよ ⑥ 同時並行でせよ ⑦ 安上がりにせよ 闇雲にリソースを増やす前に処理そのものを見直す考え方 出典 oreilly.co.jp/books/97848144… #Linux #性能
4
1
77
5,886
OracleのREDOは、なぜ必要? 例えばUPDATEでは、Data BlockだけでなくUNDOの変更もREDOに記録されます。 ① 変更履歴をRedo Log Bufferに格納 ② LGWRがOnline Redo Logへ書き込み ③ 障害発生時はREDOを使って変更を復旧 図解で解説しています👇 eeengineer.com/oracle-redo-c… #Oracle #Database
Oracle DatabaseでUPDATEを実行すると、内部では何が起きる? ① UNDOで更新前の情報を保持 ② Data Blockを変更(Dirty Buffer) ③ REDOで変更履歴を記録 ④ COMMIT時にLGWRがREDOを書き込む ⑤ DBWnは独立してDatafileへ書き込む 詳細は以下👇 eeengineer.com/oracle-databa… #Oracle #Database
1
7
477
Brendan Gregg氏が紹介している「パフォーマンスチューニングの7原則」 ① するな ② 二度するな ③ 減らせ ④ 先に延ばせ ⑤ 見られていないときにせよ ⑥ 同時並行でせよ ⑦ 安上がりにせよ 闇雲にリソースを増やす前に処理そのものを見直す考え方 出典 oreilly.co.jp/books/97848144… #Linux #性能
5
2
43
7,134
Are you using the right performance tests? ① Load: Normal traffic ② Peak: Expected maximum ③ Stress: Find limits ④ Spike: Sudden surges ⑤ Soak: Long-term stability ⑥ Failure: Test failover More Details👇 eeengineer.com/en/web-perfor… #PerformanceTesting #WebPerformance
1
1
7
463
How do you find high-load SQL in PostgreSQL? 🔍 pg_stat_statements lets you compare: • calls : execution count • total_exec_time : cumulative execution time • mean_exec_time : average time per execution Details👇 eeengineer.com/en/database-p… #PostgreSQL #SQL #Database
2
330
Why can retries make an overloaded system even worse? Fixed-interval retries can cause many clients to retry at the same time. Exponential backoff increases the delay, while jitter adds randomness to reduce synchronized retries. More👇 eeengineer.com/en/prevent-we… #Performance #SRE
1
4
362
What makes G1 GC different from other Java garbage collectors? ① Regions: Divides the heap into regions ② Concurrent Marking: Identifies live objects while the app runs ③ Mixed GC: Collects young and selected old regions Details👇 eeengineer.com/en/jvm-perfor… #Java #JVM #G1GC
How does Tomcat handle incoming HTTP requests? Here's the NIO Connector flow: ① SYN Queue ② Accept Queue ③ Acceptor Thread ④ Connection Management ⑤ Poller Thread ⑥ Worker Thread Pool Each stage has a different role. More👇 eeengineer.com/en/tomcat-per… #Tomcat #Java #Linux
1
2
6
515
How does Tomcat handle incoming HTTP requests? Here's the NIO Connector flow: ① SYN Queue ② Accept Queue ③ Acceptor Thread ④ Connection Management ⑤ Poller Thread ⑥ Worker Thread Pool Each stage has a different role. More👇 eeengineer.com/en/tomcat-per… #Tomcat #Java #Linux
1
2
1
15
1,366
Oracle DatabaseでUPDATEを実行すると、内部では何が起きる? ① UNDOで更新前の情報を保持 ② Data Blockを変更(Dirty Buffer) ③ REDOで変更履歴を記録 ④ COMMIT時にLGWRがREDOを書き込む ⑤ DBWnは独立してDatafileへ書き込む 詳細は以下👇 eeengineer.com/oracle-databa… #Oracle #Database
Oracle DatabaseのDirty Bufferは、いつDatafileに書き込まれる? UPDATEなどで変更されたData Blockは、まずDatabase Buffer Cache上でDirty Bufferになります。 DBWnが書き込む主なタイミングは主に3つ。 ① 再利用可能なBufferの不足 ② Checkpointの進行 ③ 定期的な書き込み処理 COMMIT時に必ずDatafileへ書き込まれるわけではありません。 詳しくは以下のブログを参照ください👇 eeengineer.com/oracle-databa… #Oracle #Database #インフラエンジニア
1
1
15
1,091
ApacheのMPM、Prefork・Worker・Eventの違いを説明できますか? ① Prefork:Process単位で接続を処理 ② Worker:複数Threadで並列処理 ③ Event:Keep-Alive待機中のThread占有を削減 特に重要なのは、待機接続の扱い方です。 詳細は以下👇 eeengineer.com/apache-perfor… #Apache #Linux #インフラ
Apacheの性能チューニング、考え方を整理できていますか? Requestが増えたときの流れを頭に入れてチューニングすることが大切です。 ①Request増加 ②BusyWorkers増加 ③MaxRequestWorkers付近まで使用 ④新しいRequestをすぐ処理できない ⑤accept待ちのConnectionが増加 ⑥後段のTomcat / DBも影響 ⑦Response Time悪化・Timeout・接続失敗 Apacheだけでなく、「どこで待ちが発生しているか」をEnd-to-Endで見ることが重要です。 詳しくはブログで👇 eeengineer.com/apache-perfor… #Apache #Linux #性能チューニング #インフラエンジニア #トラブルシューティング
4
17
656
Why does response time increase so sharply as CPU utilization approaches 100%? The M/M/1 queueing model explains why. With a 10 ms average service time: • 50% utilization → 20 ms • 80% → 50 ms • 90% → 100 ms • 95% → 200 ms More👇 eeengineer.com/en/web-perfor…
2
1
5
335
What's the difference between fork() and exec() in Linux? ① fork(): Creates a child process with a new PID. ② exec(): Replaces the current program without changing its PID. Key point: fork() uses Copy-on-Write (CoW) to share memory efficiently. #Linux #LinuxKernel
What actually happens when Linux executes read() and write()? The key is the Page Cache. For read(): Application → Page Cache Cache Hit → data can be returned from memory Cache Miss → read from storage → load into Page Cache → return data For write(): Application → Page Cache → Dirty Page → Writeback → Storage A normal buffered write can complete after updating the Page Cache, while the actual storage writeback happens later. I explain Linux I/O internals with diagrams on my kindle book. amazon.com/dp/B0HP6DWQ82 #Linux #LinuxKernel #PageCache #IO #Storage #PerformanceEngineering #OperatingSystems
3
18
730
Linuxの「Anonymous Page(匿名ページ)」って何か説明できますか? ファイルに直接紐づかないメモリページのことです。 代表例は以下の3つ ① Heap:Javaオブジェクト、malloc ② Stack:関数呼び出し、ローカル変数 ③ 匿名マッピング:MAP_ANONYMOUS #Linux #メモリ管理 #インフラ
Swapされるのは、すべてのページではありません。 Linuxはメモリ不足になると、元データがない「Anonymous Page」をSwap領域へ退避させ、物理メモリを確保します。 一方、File-backed Pageは元ファイルを再読み込みできるため、ページキャッシュを解放するだけで対応できます。 「どのページを解放するか」を使い分けることで、限られた物理メモリを効率よく活用しているのがLinuxの特徴です。 eeengineer.com/linux-swap/ #Linux #LinuxKernel #インフラエンジニア #OSS #メモリ管理
3
13
856
How does Linux build an Ethernet frame? ① Look up the route ② Determine the next-hop IP ③ Resolve its MAC via ARP/NDP ④ Build the Ethernet frame More details👇 eeengineer.com/en/linux-pack… #Linux #Networking #TCPIP
What does a Linux NIC driver actually do? It bridges the kernel's network stack and NIC hardware. Key functions: ① Register access ② Descriptor rings ③ DMA mapping ④ Interrupt handling ⑤ Offload settings ⑥ Link-state monitoring More details👇 eeengineer.com/en/linux-nic-…
1
1
34
1,075
Oracle DatabaseのBuffer Cache、Clean BufferとDirty Bufferの違いを理解してますか? Data Blockの変更でDirtyになったBufferは、すぐDatafileへ書かれるわけではない Dirty Buffer → Write Queue → DBWn → Datafile 書き込み後はCleanとなり再利用される 詳細は以下 eeengineer.com/oracle-databa…
Oracle DatabaseのDirty Bufferは、いつDatafileに書き込まれる? UPDATEなどで変更されたData Blockは、まずDatabase Buffer Cache上でDirty Bufferになります。 DBWnが書き込む主なタイミングは主に3つ。 ① 再利用可能なBufferの不足 ② Checkpointの進行 ③ 定期的な書き込み処理 COMMIT時に必ずDatafileへ書き込まれるわけではありません。 詳しくは以下のブログを参照ください👇 eeengineer.com/oracle-databa… #Oracle #Database #インフラエンジニア
6
388
What does a Linux NIC driver actually do? It bridges the kernel's network stack and NIC hardware. Key functions: ① Register access ② Descriptor rings ③ DMA mapping ④ Interrupt handling ⑤ Offload settings ⑥ Link-state monitoring More details👇 eeengineer.com/en/linux-nic-…
How does Linux process an incoming network packet? The kernel processes it layer by layer: ① Ethernet (L2): MAC & EtherType ② IP (L3): IP addresses & protocol ③ TCP/UDP (L4): Ports & transport data ④ Socket: Receive buffer More details👇 eeengineer.com/en/linux-netw… #Linux #TCP
1
6
1
25
2,075
What actually happens when Linux boots? UEFI → GRUB2 → Kernel → initramfs → systemd Each stage plays a different role. Visual guide + real AlmaLinux 9 boot logs👇 eeengineer.com/en/linux-boot… CPU Internal👇 amazon.in/Linux-CPU-Internal… #Linux #RHEL #SRE
2
29
127
2,848