Client and Server Processing

  • When we use the internet, the majority of our interactions involve two types of connected entities:
    • The Client - the user’s device/browser (primarily uses JavaScript)
    • The Server - a central computer handling requests (uses languages like PHP, Python, Ruby, or Java)
  • For example:
    • If a user tries to access a website, the client requests the page, the server receives the request and sends the page to the client’s browser
    • If a user is attempting to book tickets, this may require many client-server interactions in dealing with selecting options, payments, etc.
  • During these interactions, decisions are made about what processing occurs on the client or server side based on performance, security, and usability

Client-Side Processing

  • Client-side processing involves carrying out code or tasks on the user’s device rather than the server

Benefits

  • Initial Data Validation (JavaScript) - checks simple errors (e.g., empty fields) before sending data, providing instant feedback
  • Manipulates User Interface Elements - allows for interactive features (dropdowns, pop-ups) via DOM manipulation
  • Enhanced User Experience - eliminates the need for frequent server requests and page reloads, making the site feel more responsive
  • Reduced Server Load - offloading tasks reduces the strain on server resources and reduces web traffic
  • Offline Functionality - web applications can use client-side technologies to operate without an active internet connection
  • Applies Website Styles (CSS) - ensures consistent presentation and separates design from content

Drawbacks

  • Security Risks - client-side code is visible to the user, meaning sensitive logic can be tampered with or intellectual property can be copied
  • Device Compatibility - different browsers or devices may process code differently, leading to inconsistent performance
  • JavaScript Dependency - if the user has disabled JavaScript, the functionality of the site may break entirely
  • Page Load Times - large or complex client-side scripts can increase the initial time it takes for a page to load

Server-Side Processing

  • Server-side processing involves running code and interacting with databases on the server before sending the result to the client

Benefits

  • Improved Security - sensitive processes (authentication, financial transactions) are hidden from the user, preventing exposure of internal systems
  • Database Interaction - essential for fetching, storing, and updating data like user accounts or inventory
  • Consistency - ensures the same behaviour and results across all devices because the processing logic is centralised
  • Scalability - server infrastructure can be optimised or expanded to handle increased traffic more easily than relying on varying client hardware
  • Complex Calculations - suitable for resource-intensive tasks that would overwhelm a client’s device

Drawbacks

  • Increased Server Load - multiple complex requests can consume server resources, potentially slowing down the site for all users
  • Latency - requires a “roundtrip” to the server for every action, which can lead to slower response times compared to local processing
  • Server Dependency - the application relies entirely on the server’s availability; if the server is down, the functionality is lost
  • Limited Real-time Interactivity - because it requires a roundtrip, it is less suited for tasks requiring immediate, frame-by-frame updates
  • Development Complexity - typically requires more complex setup and backend programming compared to client-side scripts

Comparison Summary

AspectClient-Side ProcessingServer-Side Processing
SpeedInstant feedback; no server contact needed.Slower due to communication latency.
Best forUI changes, real-time validation, interactivity.Security, database access, sensitive logic.
Resource UseUses the user’s device (CPU/RAM).Uses server resources (reduces client strain).
SecurityLess secure; code is public/modifiable.Highly secure; logic is hidden on the server.
TrafficReduces traffic by handling tasks locally.Increases traffic via server requests.
ReliabilityDepends on JavaScript being enabled.Centralized; logic cannot be bypassed.

Choosing Which to Use

  • Choose Client-Side for tasks requiring immediate user feedback, real-time interactions (like dark mode or dynamic menus), or reducing server costs
  • Choose Server-Side for tasks involving database access, handling sensitive user data, complex business logic, or ensuring consistent results across different hardware

Worked Example

Big Brains has produced a website that allows students to access revision videos. They want to limit access to those students with a school email account (i.e. one ending .sch.uk). When students sign up JavaScript is used to check that the email address they have entered is from a school account. The address is rechecked when it reaches the server before login details are sent to the address. Explain why checking the email address with JavaScript and again when it reaches the server is important.

3 marks

How to answer this question:

  • You need to know the following from above about client side processing:
    • Reduced Server Load: Offloading processing tasks to the client side reduces the burden on servers, improving scalability and resource utilisation
    • Dependency on JavaScript: Client side processing heavily relies on JavaScript, and if JavaScript is disabled or not supported by the user’s browser, the functionality may break or become inaccessible
  • You need to apply this knowledge to the scenario in the question

Answer:

Example answer that gets full marks: The JavaScript check is carried out client side meaning the address can be checked and stopped before reaching the server reducing the unnecessary load on the server.

Acceptable answers you could have given instead: JavaScript can be amended and circumvented therefore address must be checked at the server to ensure this has not happened.