Git Product home page Git Product logo

http_server_assignment's Introduction

HTTP Server Optimization - Final Submission

This repository showcases the implementation of a highly optimized HTTP server, designed to meet the specific requirements outlined by Headout. The server is written in Javascript + (Node.js & Express.js), and the entire application is bundled into a Docker image named Dockerfile.

Key Features

Repository Structure

|-- app.js             # Source code for the HTTP server
|-- tmp/               # Placeholder for data files
    |-- data/
        |-- 1.txt      # Testing File 1
        |-- 2.txt      # 100 MB Testing File 2
|-- Dockerfile         # Dockerfile for bundling the application
|-- README.md          # Project README file

Instructions for Review

  1. Clone the repository.
  2. Navigate to the root directory.
  3. Review the source code in the app.js file for the HTTP server implementation.
  4. Examine the Dockerfile for Docker image configuration.

To run the Dockerfile, execute following commands

To start the server

docker compose up

To Stop the server

docker compose down

Memory & CPU Limit Screenshot

mem_limit

HTTP Server

  • Implements a robust HTTP server responding to GET requests on the /data endpoint.
  • Supports query parameters:
    • n: File name
    • m: Line number
  • Adheres to the following rules:
    • If both n and m are provided, it returns the content of the file /tmp/data/n.txt at line number m.
    • If only n is provided, it returns the entire content of the file /tmp/data/n.txt.

File Structure

  • Efficiently handles files of approximately 100MB in size.
  • More than 30 different files, ranging from 1.txt to n.txt.

Docker Image

  • The server is bundled into a Docker image named Dockerfile.
  • The Dockerfile is compatible with both ARM architecture and x86.
  • Exposes port 8080.
  • Configured to allocate a maximum of 1500 MB RAM and 2000m/2 Core CPU for the Docker container.

http_server_assignment's People

Contributors

adityaongit avatar

Stargazers

 avatar Utkarsh Mishra avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.