Architecture 2025-08-02

About Processing Models of Web Applications

Architect web applications with Event Loop, Thread, and Process models for IO-bound and CPU-bound concurrent workloads.

Read in: ja
About Processing Models of Web Applications

In this article, I will write about the typical processing models of web applications.

Overview of Each Processing Model

Event Loop Model (Asynchronous, Single-threaded)

[ イベントキュー ] → [ イベントループ ] → [ 実行 ]

Advantages

Disadvantages

Thread Model (Multi-threaded)

[ プロセス ]
 ├─ スレッド1(リクエストA)
 ├─ スレッド2(リクエストB)
 └─ ...

Advantages

Disadvantages

Process Model (Multi-process)

[ リクエストA ] → [ プロセス1 ]
[ リクエストB ] → [ プロセス2 ]

Advantages

Disadvantages

Suitability of Processing Models by Language

Language Processing Model IO-bound CPU-bound Remarks
Node.js Event Loop (Asynchronous) IO-focused, caution with heavy computation
Go goroutine + M:N threads Good at parallel and concurrent processing with lightweight threads
Ruby (MRI) Thread + GIL (limited) CPU processing is essentially single-threaded due to GIL
PHP (FPM) Process (1 request = 1 process) Stable with process separation but high overhead
Java Multi-threaded Thread optimization at the JVM level
Python (CPython) Thread + GIL (limited) Similar GIL constraints as Ruby MRI

Implementation Considerations for Each Processing Model

Event Loop Model

Thread Model

Process Model

Conclusion

Each processing model has its pros and cons, and it is important to choose the appropriate model according to the characteristics and requirements of the application. If there are many IO-bound processes, the event loop model is suitable, while for CPU-bound processes, the thread model or process model is considered appropriate. It is also good to consider the characteristics of each language.

Tags: Event Loop Thread Process
Share: 𝕏 Post Facebook Hatena
✏️ View source / Discuss on GitHub
☕ Support

If you enjoy this blog, consider supporting it. Every bit helps keep it running!


Related Articles