Recall & Review
beginner
What is a key difference between PHP and Node.js in how they handle server requests?
PHP creates a new process for each request, while Node.js runs a single long-running process that handles many requests asynchronously.
Click to reveal answer
intermediate
Why does Node.js use an event-driven model for handling requests?
Node.js uses an event-driven model to efficiently handle many requests without waiting for each to finish, improving performance for I/O tasks.
Click to reveal answer
intermediate
How does PHP's request lifecycle affect memory usage compared to Node.js?
PHP frees memory after each request ends because it starts fresh every time, while Node.js keeps memory in use as it runs continuously.
Click to reveal answer
beginner
What is one advantage of PHP's short-lived process model?
It isolates each request, so errors or memory leaks in one request do not affect others.
Click to reveal answer
intermediate
What challenge might arise from Node.js's long-running server approach?
Memory leaks or bugs can accumulate over time since the server process stays alive, requiring careful management.
Click to reveal answer
How does PHP handle each incoming web request?
✗ Incorrect
PHP starts a new process for each request, unlike Node.js which uses a single long-running process.
What is a benefit of Node.js's event-driven model?
✗ Incorrect
Node.js handles many requests efficiently by not waiting for each to finish, thanks to its event-driven model.
Which server model isolates errors per request better?
✗ Incorrect
PHP's short-lived process model isolates errors per request, preventing one request's error from affecting others.
What is a potential downside of Node.js's long-running server?
✗ Incorrect
Because Node.js runs continuously, memory leaks or bugs can build up if not managed properly.
Which technology is more likely to free memory after each request?
✗ Incorrect
PHP frees memory after each request because it starts a new process every time.
Explain how PHP and Node.js differ in handling web server requests and the impact on memory management.
Think about how each handles requests and what happens to memory after.
You got /4 concepts.
Describe one advantage and one challenge of using a long-running server like Node.js compared to PHP's model.
Consider performance and maintenance aspects.
You got /2 concepts.