Chapter 10: Dynamic Website Hosting (PHP, Python, Node.js with MySQL)
Interview Questions
These questions on PHP-FPM, Gunicorn, pm2 and 502 definitely come up in interviews. While answering, explain the architecture out loud – web, app, data.
PHP-FPM, Gunicorn, pm2 आणि 502 वर हे प्रश्न इंटरव्ह्यूमध्ये नक्की येतात. उत्तर देताना आर्किटेक्चर तोंडी समजावून दाखवा – वेब, ॲप, डेटा.
PHP-FPM, Gunicorn, pm2 और 502 पर ये सवाल इंटरव्यू में ज़रूर आते हैं. जवाब देते समय आर्किटेक्चर बोलकर समझाओ – वेब, ऐप, डेटा.
- Q1. What is PHP-FPM?
- FastCGI Process Manager supervises PHP worker pools. A web front sends configured script requests using FastCGI over the assigned Unix socket or TCP listener.
- Q2. Why do we run Gunicorn in front of a Flask app?
- Flask's built-in server is for development only. Gunicorn is a production WSGI server that runs multiple worker processes reliably; Nginx sits in front for TLS and static files.
- Q3. What is pm2 used for?
- PM2 supervises Node applications, records managed state and logs, and can support configured restarts or boot integration. Use the approved ownership and boot settings for the assigned app.
- Q4. How do you restrict a database listener to its intended clients?
- Restrict the database listener to the intended network and approved clients. A same-host app may use loopback. A private RDS design can permit the application’s assigned security group and retain independent SQL authentication.
- Q5. How do you give a MySQL user only the access the app needs?
- Create the approved role with the intended matching host and protected credential. Grant only the needed operation on its table, such as
GRANT SELECT ON appdb.students TO 'appuser'@'127.0.0.1'for this read-only scope. Verify a representative read under that role. - Q6. What causes a 502 Bad Gateway error behind Nginx?
- A proxy could not use the upstream response for a request. Compare the configured target, actual listener, protocol, direct request and front error. An unavailable process, wrong endpoint, connection issue or invalid upstream reply can produce this status.
- Q7. How do you run an application as a service on Linux?
- Build and validate an assigned service definition with the correct runtime, working directory, dedicated account and managed credential. Start it and verify the listener and real route. Enable appropriate boot activation separately if the deployment requires it.
More questions across stacks
Q. What is the Java equivalent of Gunicorn or PM2?
An embedded server can run HTTP within a Spring Boot servlet application. The runtime and chosen web server perform a different role from whichever process supervisor manages lifecycle.
Q. What is the .NET equivalent?
Kestrel is an ASP.NET Core web server. It can take requests directly or work with a reverse proxy as configured. Software supervision such as a Linux unit is a separate responsibility.
Q. WSGI vs ASGI?
WSGI defines a Python server-and-application interface around HTTP request and response. ASGI defines asynchronous-capable interfaces and protocol messages, including WebSocket support. Check worker support for the actual interface.
Q. Why one database user per app?
Assign credentials and permissions to the operations actually needed to run the app. A dedicated role helps isolate and rotate access. Keep administrative and migration permissions separate.
Q. MySQL vs PostgreSQL vs MongoDB: when?
MySQL and PostgreSQL are relational, with tables and joins, and suit orders and payments. MongoDB stores flexible JSON-like documents. Choose based on the data shape and what the team knows.
Q. How would you scale this beyond one EC2?
Run intended app instances behind a suitable load balancer. Plan compatible shared data, attachment and session handling, observed capacity and failure recovery. RDS and a shared session store are possible choices when they match the requirements.
Q. What does httpd_can_network_connect do?
On applicable SELinux policies it permits relevant confined web processes to initiate network connections. Check the actual denial and applicable policy scope before any host-level persistent change.
Q. How do you keep a Flask app running after reboot?
Define the approved service and boot activation for the assigned unit. Set a restart policy suited to its lifecycle, then verify its working directory, credentials and observed report after a planned service start.
Key terms
- Three tiers: Web, app and data.
- WSGI / ASGI: Python app interfaces used by Gunicorn and Uvicorn.
- PM2: Node.js process manager.
- systemd unit: A service definition with restart and boot rules.
- Least-privilege DB user: A role allowed only the databases, tables and operations it needs.
- 504: A gateway did not receive a necessary upstream response in time.
Mini case study
Suppose we are a junior cloud engineer at a Bengaluru e-commerce startup (sample data). The team runs a PHP admin, a Node.js storefront API and a Python report job on two EC2 instances. Using this chapter, you write a one-page runbook: which service listens where, how to test and reload each one, which logs to read, and which ports are public (only 80 and 443, plus 22 from the office IP). New team members can then fix most problems on their own.
Answer from a service you can actually explain and test
Imagine the interviewer gives you a training club's workshop site. It serves an information page and an up-to-date report of registrations. The information is publicly readable, but only staff should be able to make changes. Write four actors on a sheet of paper: browser, web front, application and database. Give each actor an action. The browser makes a named request, the front selects the right handler, application code decides what should happen, and the database returns or writes authorized data. You can now explain a connection, a responsibility, and the observation you would use to verify each one.
Answer in this order. State an assumption such as “front and app are on one Linux host.” Explain the mechanism at the relevant boundary. Give a concrete example using the site, then state how you would confirm it under the deployment's normal checked conditions. If the interviewer changes an assumption, update the answer. A private loopback listener is right for one topology. A private network address can be right when the app is on a different host. Your reasoning shows the principle even when the names of the products change.
Several questions offer a follow-up. Use the follow-up to turn a definition into something observable. Saying “502 means Bad Gateway” is a start. Saying “I would compare the exact front target and its error evidence with a representative local GET, then distinguish refused transport from a reply the proxy could not accept” gives the interviewer a specific next decision. When presenting an actual incident, be clear about observed facts and guesses. A coherent diagnosis explains why your chosen test excludes some possibilities and leaves others open.
Dynamic hosting interview questions and worked answers
1. What makes a page's result dynamic?
A dynamic result is generated by code using state or inputs at the time it is needed. When staff read the workshop report, the app can ask for current registrations and produce a suitable HTML view or JSON response. The small course information document can be prepared beforehand and read as an ordinary file. A front can serve the file directly and send the report request to the app. A dynamic route can also generate a response without a database, for example from an in-memory calculation or a separate HTTP service.
Follow-up: the layout looks the same after adding a record. How would you show the app is dynamic? Use an authorized synthetic write and compare the report's record ID and body before and after. Keep the layout files and app revision unchanged. The expected record appearing through a fresh approved read demonstrates the result responded to state. If the reader sees the previous result, check the actual request and caching policy before concluding the database did not change. A timestamp alone could have changed for unrelated reasons.
2. Describe the request path for an Express or Flask report.
The browser resolves the name and connects to the named front. After TLS as configured, it sends a method and path. The front selects the website and its report route, then sends an HTTP request to the app listener. The application matches the received path, verifies the applicable operation, obtains the expected data using its database client, and sends a response. The same backend may serve two different output formats. On this example's health route it can reply without acquiring a database connection.
Follow-up: how does a page with HTML and additional data appear in a network trace? A first GET returns the HTML. Browser JavaScript can later issue a distinct GET for data. If only the second request fails, the visible page can still have a header and blank report. Ask the user for the failing route, not just the screenshot. A direct app probe for the data and the matching routed request help locate whether the issue lies in front routing, app execution, storage, or client interpretation.
3. What is different about a PHP-FPM request?
PHP-FPM is a manager for PHP FastCGI workers. In a common Nginx arrangement, the browser submits HTTP to Nginx. The front selects an approved script route and passes a FastCGI request with script and request parameters to the configured worker socket or TCP address. PHP executes the script and returns its result to the front. That FastCGI exchange is different from HTTP proxying to a separate Express listener. Apache can also integrate with a PHP-FPM worker using appropriate modules and configuration on its platform.
Follow-up: can you test the PHP socket by sending an ordinary HTTP GET directly? Test an actual authorized PHP route through its configured front, and check FPM-specific evidence such as pool state, socket ownership and the front's FastCGI logs. Curl cannot determine whether a FastCGI worker handles its own protocol by sending that worker an unrelated HTTP request. A passing php -m command only describes the CLI context. Confirm the web runtime actually loaded the needed extension.
4. What does Gunicorn do? What do systemd and PM2 do?
In the Flask exercise, Gunicorn is the server that accepts HTTP on the assigned app port and runs the Flask application through its WSGI interface. It runs worker processes according to the configured model. Systemd can start and supervise the Gunicorn service with its required runtime identity, executable, working directory and credential. In the Node exercise, Node with Express handles HTTP and PM2 can supervise that app process. These are different responsibilities. A process manager status does not prove the app's endpoint ran the desired query.
Follow-up: what if PM2 is itself started by systemd? That can be a valid hierarchy. Draw the manager chain and identify the single app launch owner for its listener. A duplicate occurs when two independently started processes both try to claim the same address and port. Verify which process owns the intended listener and check the direct route. If the app starts in your terminal but fails as a unit, compare the actual command, environment, access to its credentials and dependencies before adjusting its HTTP port.
5. Explain the difference between WSGI and ASGI without defining them by a product.
WSGI is a Python interface between a web server or gateway and a Python application. It describes the request and response relationship of that interface. ASGI defines an asynchronous-capable interface between a network protocol server and an application using connection scopes and messages. It supports protocol forms including HTTP and WebSocket with their corresponding sub-specifications. The interface is the agreed way that server and code communicate. Uvicorn can serve ASGI, and Gunicorn has different supported worker configurations, including ASGI in its current documented offering. Select an interface and worker suited to the actual application version.
Follow-up: if you choose an async interface, will all database calls now be concurrent and fast? The choice does not change a synchronous driver or slow statement by itself. Investigate what the framework and driver wait on, which worker executes the request, and how many database sessions actually exist. Avoid guessing throughput from a label. Test the app under expected traffic and observe latency, dependency time and resource share. The solution may be shorter database work, appropriate asynchronous libraries or a deliberate worker and pool policy.
6. Is Spring Boot or Kestrel the Java or .NET version of PM2?
Describe which role you mean instead of matching names. A Spring Boot servlet application can package and start its own embedded web server, depending on its selected dependencies, or it can be deployed with a separate servlet container where appropriate. Kestrel is an HTTP server for ASP.NET Core. It can run directly or behind a configured proxy according to the hosting architecture. A process supervisor is a second responsibility. For example systemd can own the lifecycle of an assigned process on Linux regardless of whether a Java or .NET runtime receives HTTP.
Follow-up: how would you verify adopting a new stack? Maintain the same operation and planned contract. Verify the actual run command and listener, then check the correct site and route, response body and database call. Revise details such as HTTP host selection, TLS termination, manager and dependency check for that stack. Successful local demo commands in one language give little evidence that a different managed configuration has been supplied correctly.
7. Why do people put a reverse proxy in front of an app?
A reverse proxy can present a stable named site, provide its configured TLS entry, choose among paths and collect request logs. The app can use a separate address meant for that front. A browser connection and upstream connection are separate. Correctly terminating TLS at the front provides protection for the browser-to-front connection. Decide what confidentiality and server identity the private connection requires in its own topology. Also decide which request metadata and routes the app needs and which hops that metadata should come from.
Follow-up: can it expose the app under /reports/ even when the app handles /api/students? Yes when the selected rule maps the public prefix to the intended upstream URI. Verify an actual target request and any links, JSON fetches or redirects the app generates. Proxy rules can rewrite particular redirect headers, but changing a prefix can still break a browser's asset path or a cookie scope. The working root response is one check among several for a complete route.
8. Why would an app on the same host listen on loopback?
In the single-host example, the front can open the app's loopback listener from the same networking environment. Outside clients connect to the approved front. They do not need a network rule allowing them to use the app port directly. A process that binds on loopback does not receive normal client traffic destined for a different network interface. Keep route authorization at the application layer for the requests that remain accessible through the front. The bind address narrows network reachability; the route policy decides which commands a reached client can perform.
Follow-up: what changes when the front and app run on separate EC2 instances? The front's own loopback no longer identifies the app. Give the application a suitable private listener and restrict its reachability to authorized peers. Choose transport protection and identify who owns the target. If RDS runs in a private location, the app uses its assigned endpoint and approved connection settings. A database port can be reachable from the app without being open to the internet. The same port numbers can support different topologies with different controls.
9. Does an access-denied error mean the database server is unreachable?
A database server replying with an access error has been reached in that exchange. Check which user and host account matched, whether the required credential and connection settings agree, and whether the server's authentication method is supported by the application. Access can also be denied for the requested database or statement after login. Verify a narrow app read with the correct connection method and intended role. A privileged administrator using a local socket may view the right data while the app's TCP identity lacks those permissions.
Follow-up: why separate migration permissions from runtime permissions? A workshop report needs only the operations it performs. Schema updates, administrative settings and account management are a different set. A dedicated migration role can perform its explicitly approved change under separate supervision. That limits what long-running code can alter and lets you check the deployment as its real role. If the runtime reads two tables, assign those rights. A whole-database grant can still be excessive when the app uses only one part.
10. How would you move a secret into a managed application?
Define the secret source, which service identity reads it, how the private value reaches the process, and how it changes over time. On a supported host an approved systemd service can receive a private credential projection. On AWS a suitable workload role can have scoped permission for the assigned Secrets Manager secret, as one possible integration. Match permissions, lifetime and namespaces to the deployment. Do not put a reusable database password into a code example or a public file. An environment value may be appropriate for one disposable test, but deployment and process tools can persist its values if configured carelessly.
Follow-up: if the deployment is already working, why test a new connection during rotation? The running service can use a stored copy of its configuration or already authenticated database sessions. It can therefore appear to succeed without proving the replacement identity works. Plan how to acquire the new value, start a fresh process or connection, verify the narrow query and then retire the prior credential under the intended rotation sequence. Keep logs free of any actual credential material.
11. What evidence decides between 404, 502, 504 and 503?
Start with who issued the response. For 404 ask whether the selected front route exists or the application replied that the resource or route was absent. For a gateway 502 compare the intended upstream and protocol with the direct app evidence and front error. For a gateway 504 identify the waiting phase and which timer reached its limit. For 503 examine which component says it is unable to serve now. The application may be alive while its database cannot provide the report. Match the request with exact hostname, path, time and appropriate logs before deciding which component owns the repair.
Follow-up: why does curl -I sometimes give a misleading check? It sends HEAD. The expected user operation in this story is GET, and it needs a response body to prove that the report contains the expected record. HEAD may be implemented differently or may not be supported by that route. Reproduce the method that failed with harmless input and ordinary access rules. Record the actual response marker, as well as the reported status.
Continue with deployment, state and capacity scenarios
12. What changes when the workshop adds multiple app processes?
Compute the capacity per process and the aggregate demand. Each Express process in the lesson can create its own pool of four SQL sessions. Two such processes can use up to eight, and three can use twelve. An app may open fewer while idle or when requests are serial. Include other database workloads and operational margin in the deployment's budget. If the database spends too long in each query, adding app processes can increase pressure on the same downstream service. Measure where the time is spent before scaling one part of the route.
Follow-up: how does queue size relate to connection size? A pool can have a fixed count of active connection slots and allow waiting work when those are occupied. The allowed waiters are separate from sessions. A queue length is not a deadline. Opening a connection, waiting for an available one, running a statement and sending a response can all have different limits. A client can time out before the app or database is done. For user-visible writes, define a way to safely identify the result before assuming a lost response means the operation never happened.
13. How do you scale beyond one EC2 instance without losing a user's work?
List the state the application owns. Current database records may belong in a private shared database such as RDS. Uploaded attachments may need approved shared durable object storage. User sessions may need an intentionally shared store or suitable signed client state. Temporary caches can be rebuilt. More app instances can serve traffic through an approved load balancer when they handle compatible requests. The right plan follows the app's consistency and recovery requirements. A Redis-based session store is one design option, and sticky routing can be appropriate in particular deployments. Neither replaces a defined recovery plan for important data.
Follow-up: what can go wrong if a staff login exists only in one process's memory? A later request reaching a different instance may not see that session. Restarting the original process may also lose it. An operator who sees alternating outcomes should confirm the requesting session, selected target and where the expected state lives. Avoid assuming uneven behavior is a network rule problem. A separate report test can show database consistency while sign-in still fails, because durable report data and sessions are different stores.
14. What can an ALB health check or EC2 status check prove?
State which check ran. EC2 status checks cover documented categories, including opt-in application checks on configured responses. An ALB target group has its own configured health protocol, endpoint and success criteria, which collect a particular target observation. If the path serves a static text response, a healthy result can coexist with a failing report. A separate synthetic monitored operation can verify workflow coverage. AWS also documents routing to all registered targets if a target group only has unhealthy ones, so read health criteria and target state in context.
Follow-up: should an internal health route share every detail with a public visitor? Publish only information appropriate to that audience. A narrowly scoped health response may be sufficient for routing and monitoring. Internal operators can look up specific evidence for app and database boundaries with authorized access. Use a real named user flow and approved synthetic markers for broader checks. Do not reach for a privileged endpoint simply to prove that the homepage loads.
15. Do background tasks belong behind the same reverse proxy?
Some work should complete in the user's HTTP operation. Other work can outlive it, such as producing a large monthly report. A separate worker can receive and process a queued report job. The web app can return an agreed acknowledgement and a way to check status. A worker may not have any incoming HTTP listener in this design. It still needs ownership, failure handling, access to the correct tasks and data, and verification of completed artifacts. Holding an HTTP connection open for all report generation can consume resources and run against proxy or client timers.
Follow-up: when should the app return success? Decide what constitutes an accepted job versus a complete artifact. A successful acknowledgement only confirms the initial handoff under the contract. The status or result endpoint should describe ongoing processing, failure recovery or final availability. Include a stable internal job identifier so a retried user request can be reconciled under the app's design. A practice lab can keep its report small and synchronous, making that additional architecture unnecessary until the question's assumptions change.
16. How do you choose between relational and document storage?
Start with operations and invariants rather than a brand. A workshop may require each registration to reference a valid session and a unique participant association, with reliable related updates. A relational model can express these relationships as tables and constraints and query across them. A document database can represent related fields in a natural stored document shape for certain access patterns. Consider expected query paths, transactions, data growth, schema evolution, backups and team operations. MySQL and PostgreSQL are both relational engines but have distinct supported features and operational choices. MongoDB's document model offers a different set of modeling decisions.
Follow-up: should we switch storage to solve a login problem at rollout? First confirm the runtime address, authentication and schema requirements for the current app. A storage engine replacement adds new driver, data models and operational behavior. The right engine choice does not cure a missing secret, an app targeting the wrong hostname or a wrong site route. Show how you would verify the original failure independently before proposing a larger data change.
17. Explain how you would do a narrow and reversible rollout.
Identify the release, listener, users and operation to protect. Validate candidate syntax and start within an allowed environment with suitable permissions. Check candidate readiness and the actual synthetic report before moving traffic. Confirm the expected site and body through the same request path real learners use. Keep a known prior configuration and compatible target available. If there is a migration, record its timeline with the data owner and define what prior code can understand. A reverse proxy config restored to yesterday's port achieves little if today's schema cannot be used by yesterday's app.
Follow-up: what does a drain period protect? In-flight requests may need time to finish as a target stops receiving new ones. A load balancer can have an intended deregistration delay, while the application needs its own graceful stop procedure. The timing should suit the app's request contract, and the service must handle interrupted work appropriately. Record both configured behavior and lifecycle evidence. The exact delay and supported options depend on the service. Avoid memorizing a single wait as a substitute for deciding what the deployment needs.
18. Why might a browser show yesterday’s registrations after a new read worked?
If the direct application read is current but a browser through the named site shows earlier data, compare the exact request and response source. A browser, CDN, web front or application can reuse data according to its policy. The browser could also be calling a different data route or requesting a different date. Check the network entry, request URL, response age or cache evidence and a sentinel record. A successful SQL query verifies the underlying record exists. It gives no proof that the same representation reaches every client through every caching layer.
Follow-up: would you turn caching off everywhere? Choose a freshness and access policy for each kind of response. A versioned logo can tolerate long reuse. A sensitive private list may require a no-store policy and appropriate controls across its serving path. A publicly available aggregate can tolerate a documented short delay in some designs. Check whether the current policy matches the required data and whether older cached content is still in scope before choosing an approved remedy. Avoid broad cache invalidation until you know which cache and representation produced the observed result.
19. The registration request timed out. Can we submit it again?
A client timeout cannot distinguish whether the app never reached the write, was still processing, or committed successfully before the response was lost. A blind repeat for a real account may create duplicate work. Define a stable identifier for the business operation and a way to query its outcome. If the service has an idempotency contract, repeated requests bearing the appropriate same identifier can be recognized and handled according to that contract. An explicit response saying a row was accepted or an assigned ID can help reconciliation. Ensure the storage layer enforces the appropriate business invariant as your workflow requires.
Follow-up: why doesn't turning every write into GET make it easier to retry? The method communicates expected semantics to clients and intermediaries. A GET is expected to be safe in HTTP; software may follow or repeat safe requests for its normal operation. Creating a registration is a change to application state that belongs behind an explicitly authorized mutation handler. The readiness check and report GET in this lab are legitimate harmless reads. Use the proper configured write operation only in its defined scope and verify stored effects independently.
20. What is a good contract for application logs?
Start with the question those logs support. If reports sometimes fail, the contents should let an operator find the affected request in an appropriate time range, recognize the service and version, and identify the operation and failure phase. An identifier consistent across trusted components can be useful. The log should avoid credentials and private data unless their specific collection and handling have been approved. In the troubleshooting fixture, the reader sees a generic error and a test identifier. The operator sees that the same request failed during open or query, with a scoped error category.
Follow-up: can you conclude that the app never received a request if only the access log appears? Check how the app logs events, whether the relevant process and time range were queried, and what the front observed. Unavailable or uncollected logs can create a misleading gap. A refusal recorded before the front could send HTTP gives stronger evidence for that attempt. A static front route with no configured upstream can legitimately have no app entry. Distinguish the absence of expected evidence from a verified diagnosis of why it is absent.
21. How would you verify a successful restore after a database-related failure?
Keep application rollback and data restoration separate. A front config can send traffic back to an earlier reachable service. A real database recovery can have its own time, backup and target settings. Define how much data loss and downtime the service can tolerate according to its requirements. An authorized restore into an approved test scope should demonstrate that the expected schema, identities and representative record can be read. The application still needs to point to the proper restored endpoint and understand that schema. Exercise a safe user operation through the real front path before accepting the result.
Follow-up: what if the restored dataset has the right number of rows? Counts are useful but multiple versions can share a count. Choose a known authorized marker, field, report date or business relationship that distinguishes the desired state. If operators must accept new writes after recovery, verify the expected permissions and reconcile any work that was pending at the time of failure. Keep a plan for routing back if the candidate restore fails validation. The practice exercises use only synthetic data and illustrate checks, not a prescription for changing a live database.
Lab. Demonstrate one good read and one refused write during an interview
Use the disposable database setup and Express source from the schema lesson and the Express lesson. Use only the assigned local workspace, limited MySQL account and seed dataset. The interview exercise uses normal read-only startup and does not need a local token or any real student information. The repeatable goal is to show the difference between a method handler and its independently scoped deployment mode. A paper answer is acceptable for the interview itself, but running this small proof before it gives you a reliable story to tell.
Start the complete lesson app without the local-write argument at its assigned loopback listener using the documented database settings and temporary practice credential. In this sample that is port 18806. If your assigned port differs, update the commands. Use a separate terminal to make a health check, a readiness check and a real data request. The assigned MySQL dataset contains only the expected synthetic rows. In a correctly prepared copy, the data route returns JSON with three initial IDs. Compare availability and actual result. Then send the documented synthetic POST to the same selected private interview app. The ordinary launch should deny it without changing the seeded records.
curl --noproxy '*' --max-time 5 --include --write-out '\n' http://127.0.0.1:18806/health
curl --noproxy '*' --max-time 5 --include --write-out '\n' http://127.0.0.1:18806/ready
curl --noproxy '*' --max-time 5 --include --write-out '\n' http://127.0.0.1:18806/api/students
curl --noproxy '*' --max-time 5 --include --write-out '\n' \
--request POST --header 'Content-Type: application/json' \
--data '{"name":"Interview practice only","city":"Pune"}' \
http://127.0.0.1:18806/api/students
curl --noproxy '*' --max-time 5 --include --write-out '\n' http://127.0.0.1:18806/api/students
The expected status sequence is 200, 200, 200, 403 and 200. Neither read should contain the interview-only marker. The first successful health request proves the listener can answer a simple HTTP operation. Readiness proves its configured table query works. The data route returns the intended rows under the proper role. The refused POST exercises the configured server rule. The final read verifies its observable effect on the supplied example. An interviewer can understand the difference between a browser hiding a submit button and a server actually refusing the operation.
Suppose the status for the POST is 403 but the ordinary read also returns 503. You can still say the application enforced its access mode for the attempted request. You cannot assert the report works, and you should not use an unavailable read as proof that persistence stayed unchanged. Inspect the app settings and intended MySQL role, then repeat both probes before calling the scenario complete. The interview exercise needs a known working read on both sides of the denial. If the response was 201, stop and inspect the actual startup flags and target. Keep the exercise disposable and identify the synthetic record so the authorized training data owner can clean it if necessary.
Deliver a two-minute explanation using the five observations. Say which requests exercised a database query and which returned before one. Say which facts are only true for the developer fixture. A production read-only role would also restrict statements on the database independently of the app method gate. No real deployment setting was changed to run this interview example. Stop only your local process when done and retain or clear the synthetic datasets according to the earlier lab procedure. Keep outputs of timestamps and statuses rather than any credential used for the test.
Quiz yourself on the follow-up decisions
A candidate uses a WSGI app behind an HTTP proxy. Which component executes the application interface?
Show answer
The configured Python application server such as the Gunicorn instance in the Flask exercise. The front speaks HTTP to that server, which then invokes the app under its WSGI contract.
A private front cannot reach an app on a different host using loopback. Which address is wrong?
Show answer
The front's loopback is its own network environment. Select an approved private listener or service address for the actual app and verify allowed reachability.
Why can all target health checks pass while the actual report fails?
Show answer
They can check a narrower endpoint and miss a dependency or query required by the user path. Add a separate meaningful check for the real workflow.
Three Express processes each use at most four SQL sessions. Will a pool queue create extra SQL sessions beyond twelve?
Show answer
The configured aggregate limit is twelve for those processes. The queue holds requests waiting for a session and is a separate resource.
In the lab the public-style POST is denied, but there is no working data read afterward. What conclusion is missing?
Show answer
You observed a denial. Restore or inspect the authorized read to verify the report still works and see that the expected data state holds.
Revision cards
- Content generation
- A dynamic route runs code using request inputs or state. Prove the expected content or change through a representative authorized request.
- Handler and supervisor
- An HTTP server or worker runs a route. A service manager owns lifecycle and restart. Verify their responsibilities independently.
- Gateway interface
- FastCGI, WSGI, ASGI and HTTP describe different communication boundaries. Choose checks that speak to the intended boundary.
- SQL reach and scope
- Connect to the intended endpoint, authenticate under the assigned identity and verify the narrow statement. Each proves a distinct result.
- Health versus workflow
- Availability checks depend on the exact operation they perform. Test a synthetic reader result with a known record and body.
- Compatible release recovery
- Keep a working flow through front, app and data. A prior process must still understand the schema and state it reads.
Practice a second interview with a different hypothesis
Ask a partner to play the person reporting the problem. They choose one of these symptoms without telling you the cause: the app returns 502 after a deploy, the database denies a statement, a valid TLS hostname shows the wrong site, or the report serves an older data result. Start with a question about what was attempted and how the reader knows it failed. Draw the relevant request path and explain the next narrow check. Your partner should be able to answer with a specific observation rather than making up a vague “server problem.”
Then explain how you would verify a recovery to the original service, even if you are not the person authorized to change it. Describe the expected status, meaningful output and any independent nearby check. Ask the partner which claim in your answer assumes knowledge of the system. If you assumed the front and app share a host, change the scenario to two hosts and update the listener design. If you assumed the source is a database, change it to an external API and identify the appropriate credential and response evidence instead. The interviewer can see you reason about boundaries rather than relying on one set of memorized ports.
Score the answer on evidence and awareness of limits. Give one point for identifying the actual user operation, one for separating the responsible boundaries, one for a safe test that distinguishes two explanations, and one for a clear recovery check. Drop a point whenever the proposed observation could come from the wrong hostname, wrong account or wrong method. A strong explanation states which result would change your mind. If the initial clue turns out to be a working default site, you should be able to explain your next check without restarting any service.
Official references
- PHP-FPM and Nginx FastCGI configuration
- Gunicorn, WSGI specification and ASGI specification
- Spring Boot web server choices and Kestrel deployment
- systemd service management and PM2 process lifecycle
- Nginx proxy boundaries, HTTP semantics and curl probes
- MySQL access grants, connection troubleshooting and MySQL2 connection pools
- AWS credential handling and RDS access topology
- EC2 status checks, ALB target health and target draining
- HTTP caching and RDS point-in-time recovery
Quick revision cards
Revise this lesson in two minutes. Save the cards on your phone or download them as PNG files. The QR code on each card opens its lesson.

More cards: Ravi Sir's Cards.