0
0
Nginxdevops~20 mins

Event-driven architecture in Nginx - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Event-driven NGINX Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Understanding event-driven architecture in NGINX

Which statement best describes how NGINX uses event-driven architecture?

ANGINX uses a polling mechanism that blocks until all connections are closed.
BNGINX uses a single thread to handle all connections synchronously, blocking on each request.
CNGINX uses multiple threads, each blocking on a single connection, to handle requests.
DNGINX uses an event loop to handle many connections asynchronously without blocking threads.
Attempts:
2 left
💡 Hint

Think about how NGINX can handle thousands of users at once without creating a thread per user.

💻 Command Output
intermediate
2:00remaining
NGINX event module configuration output

Given this NGINX configuration snippet, what is the output of nginx -T regarding the worker_connections setting?

Nginx
events {
    worker_connections 1024;
    use epoll;
}
A
events {
    worker_connections 1024;
    use epoll;
}
B
events {
    worker_connections 512;
    use kqueue;
}
C
events {
    worker_connections 2048;
    use select;
}
DSyntax error: unknown directive 'worker_connections'
Attempts:
2 left
💡 Hint

Check the configuration snippet carefully and what nginx -T outputs.

🔀 Workflow
advanced
2:30remaining
Configuring NGINX for event-driven load balancing

You want to configure NGINX to efficiently handle many simultaneous client connections using event-driven architecture. Which configuration snippet correctly sets the event model and worker connections?

A
events {
    worker_connections 512;
    use select;
}
B
events {
    worker_connections 1024;
    use poll;
}
C
events {
    worker_connections 4096;
    use epoll;
}
D
events {
    worker_connections 2048;
    use kqueue;
}
Attempts:
2 left
💡 Hint

Choose the event method best suited for Linux and the highest worker_connections for load.

Troubleshoot
advanced
2:00remaining
Troubleshooting NGINX event module errors

After updating your NGINX configuration, you get this error on reload: unknown directive "use epol" in /etc/nginx/nginx.conf. What is the cause?

AThe <code>events</code> block is missing a closing brace.
BThe directive name is misspelled; it should be <code>use epoll;</code> not <code>use epol;</code>.
CThe <code>worker_connections</code> directive is missing.
DThe <code>use</code> directive is deprecated and no longer supported.
Attempts:
2 left
💡 Hint

Check the spelling of the event method directive.

Best Practice
expert
3:00remaining
Optimizing NGINX for event-driven high concurrency

Which of the following is the best practice to optimize NGINX for handling a very high number of concurrent connections in an event-driven architecture?

AIncrease <code>worker_processes</code> to the number of CPU cores and set <code>worker_connections</code> high, use <code>epoll</code> on Linux.
BSet <code>worker_processes</code> to 1 and <code>worker_connections</code> to 1024, use <code>select</code> event method.
CDisable event-driven mode and use multi-threading with blocking I/O.
DUse <code>poll</code> event method and set <code>worker_processes</code> to half the CPU cores.
Attempts:
2 left
💡 Hint

Think about how to fully utilize CPU cores and the best event method on Linux.