Skip to content

Go Sorting Server: Efficiently sort arrays with sequential and concurrent processing. Dockerized and deployed on Railway Render for easy integration. Auto updates Docker Image on every commit.

License

Notifications You must be signed in to change notification settings

AdityaDwivediAtGit/Go-Sorting-Server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go Sorting Server

This Go application serves as a demonstration of sequential and concurrent sorting of arrays. It provides two endpoints, /process-single and /process-concurrent, to showcase sorting methods with performance measurements.

Features

  • Sequential Sorting: The /process-single endpoint sorts each sub-array sequentially.
  • Concurrent Sorting: The /process-concurrent endpoint sorts each sub-array concurrently using Go's concurrency features (goroutines, channels).
  • Performance Measurement: Both endpoints measure the time taken to sort all sub-arrays and return the results in nanoseconds.

Getting Started

Prerequisites

  • Go installed on your machine
  • Docker installed for containerization

Running the Server Locally

  1. Clone this repository:

    gh repo clone AdityaDwivediAtGit/Go-Sorting-Server
  2. Navigate to the project directory:

    cd go-sorting-server
  3. Run the server:

    go run main.go

    The server will be accessible at http://localhost:8000.

API Endpoints

  • Sequential Processing:

    curl -X POST \
      -H "Content-Type: application/json" \
      -d '{"to_sort": [[1, 2, 3], [4, 5, 6], [7, 8, 9]]}' \
      http://localhost:8000/process-single
  • Concurrent Processing:

    curl -X POST \
      -H "Content-Type: application/json" \
      -d '{"to_sort": [[1, 2, 3], [4, 5, 6], [7, 8, 9]]}' \
      http://localhost:8000/process-concurrent

Dockerization

This application can be containerized using Docker. To build and run the Docker image:

docker build -t go-sorter .
docker run -p 8000:8000 go-sorter

Or you can directly pull my Docker image and run the container:

docker pull infiniteintegrator/go-sorter
docker run -p 8000:8000 infiniteintegrator/go-sorter

Accessing Railway Render Deployment

You can make requests to the deployed application on Railway Render using the provided URL:

# Example for sequential processing
curl -X POST \
  -H "Content-Type: application/json" \
  -d '{"to_sort": [[1, 22, 13], [4, 15, 6], [17, 8, 9]]}' \
  https://go-sorting-server-production-a169.up.railway.app/process-single
# Example for concurrent processing
curl -X POST \
  -H "Content-Type: application/json" \
  -d '{"to_sort": [[1, 22, 13], [4, 15, 6], [17, 8, 9]]}' \
  https://go-sorting-server-production-a169.up.railway.app/process-concurrent

image

Contributions

Feel free to provide feedback or suggestions! Contributions are welcome.


Author: Aditya Dwivedi

About

Go Sorting Server: Efficiently sort arrays with sequential and concurrent processing. Dockerized and deployed on Railway Render for easy integration. Auto updates Docker Image on every commit.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published