Knowledge / Information Technology / Server-side web development

Server-side web development

Information Technology (B.E./B.Tech) · Web and enterprise · free study notes for exams, placements and interviews

In short

Server-side web development is the part of a web application that runs on the server: it accepts an HTTP request, executes program logic, talks to databases and other services, and returns a response (HTML, JSON or a file). It matters because business rules, data integrity, authentication and security can only be trusted where the user cannot tamper with the code. University syllabi examine it as "Web Technology"/"Web Programming" (servlets, JSP, PHP, sessions, MVC, three-tier architecture) and GATE-level CS papers touch it through HTTP, cookies and concurrency. Every Indian IT employer — TCS, Infosys, Wipro, Cognizant, Accenture, Zoho, Freshworks, Zoho/Zomato/Flipkart-type product firms and every bank's digital team — hires for it, and India-specific systems (UPI, Aadhaar e-KYC, GST returns, DigiLocker, IRCTC) are built on it.

Explained

The request-response cycle and where server code sits

Server-side execution models

Java servlets and JSP (the exam core)

Architecture: MVC, layers and rendering strategies

State, sessions and authentication

Security, performance and Indian compliance

Key points

Formulas and examples

Throughput (Little's Law): L = λ × W — L = average concurrent requests in the system, λ = arrival rate (requests/second), W = average response time (seconds)
Required worker threads ≈ λ × W (add headroom; blocking I/O workers scale with W)
Server utilisation ρ = λ / (c × μ) — c = number of workers, μ = requests/second one worker can finish (μ = 1/service time); ρ must stay < 1
Average wait (M/M/1 approximation): W = 1 / (μ − λ) seconds
Availability: Uptime % = (total time − downtime) / total time × 100
Cache effective latency = h × T_cache + (1 − h) × T_origin — h = hit ratio (0-1), T in milliseconds
Bandwidth per second = requests/second × average response size (bytes); 1 Mbps = 125 kB/s
Cost per request (₹) = monthly infrastructure cost (₹) / monthly request count

Example 1 — Sizing worker threads from Little's Law. A Spring Boot result portal receives 600 requests/minute with an average response time of 250 ms.

Example 2 — Utilisation and queueing. Each worker can serve one request in 200 ms, so μ = 5 requests/second. The app runs c = 10 workers and λ = 40 requests/second.

Example 3 — Cache hit ratio pays for itself. A fee-payment dashboard query takes 180 ms from PostgreSQL and 4 ms from Redis.

Example 4 — Bandwidth and cost. An e-commerce API serves 250 requests/second with an average JSON response of 12 kB.

Example 5 — Servlet counter: why threads matter.

@WebServlet("/hits")
public class HitServlet extends HttpServlet {
    private int hits = 0;                       // shared by ALL threads - unsafe
    protected void doGet(HttpServletRequest req, HttpServletResponse res)
            throws IOException {
        hits++;                                 // read-modify-write, not atomic
        res.setContentType("text/plain");
        res.getWriter().println("Hits: " + hits);
    }
}

With 1,000 concurrent requests the printed total is often less than 1,000 because two threads read the same value. Fix: private final AtomicInteger hits = new AtomicInteger(); then hits.incrementAndGet(), or keep per-user counts in the session.

Comparison tables

AspectServer-side renderingClient-side rendering
HTML built byServer, per requestBrowser JavaScript
First paintFastSlower (JS download + fetch)
SEONativeNeeds prerender/SSR fallback
Server CPUHigherLower (JSON only)
Interactivity after loadFull page reloads unless hybridSmooth, app-like
Typical fitGovernment portals, banking, content sitesDashboards, SPAs, internal tools
TechniqueWhere storedScales horizontallyRevocableTypical use
Server session (in-memory)App server RAMOnly with sticky sessionsInstantlySmall single-node apps
Session in Redis/DBShared storeYesInstantlyMost web apps
Signed cookieClient, signedYesOnly at expirySmall preference data
JWT bearer tokenClientYesHard (needs denylist)APIs, mobile backends
ModelConcurrency unitMemory costBlocking I/OExamples
CGIProcess per requestVery highTolerableLegacy Perl scripts
FastCGI/FPMPooled processesMediumTolerablePHP + Nginx
Thread per requestThreadMediumTolerableTomcat, Spring MVC
Event loopCallbacks/async tasksLowMust be avoidedNode.js, Nginx, FastAPI

Where it is used

Interview questions

Common mistakes

Related topics

Back-end development with Node.js · REST APIs · API integration and middleware · Web fundamentals: HTML, CSS and JavaScript · Database management systems and SQL · Computer networks: HTTP, TCP/IP and TLS · Cloud deployment and DevOps

Open in the Knowledge reader →Find jobs →