Giter VIP home page Giter VIP logo

next-on-do-bench's Introduction

Next.js Performance Benchmark on DigitalOcean App Platform

This repository contains a simple Next.js application and a k6 script for performance benchmarking. The Next.js application includes an API that sleeps for 50ms and then generates a random number. The k6 script measures the application's performance on a DigitalOcean App Platform server.

Benchmark results are at the bottom of this README.

Prerequisites

You need to have Node.js and npm installed on your machine to create the Next.js application. Install k6 for the performance testing.

Next.js Application

The Next.js application contains a single API at pages/api.js. This API waits for 50ms, generates a random number, and returns it in a JSON response.

Deploying the Application

Follow these steps to deploy the Next.js application to the DigitalOcean App Platform:

  1. Sign up for DigitalOcean App Platform and click 'Create App'
  2. Select your repo and branch, then hit 'Deploy'

Your Next.js application should now be live on DigitalOcean.

Performance Testing with k6

We use k6 for performance testing due to its flexibility in defining performance test scenarios. The k6 script (bench.js) included in this repository ramps up the load to 50 virtual users (VUs), holds it for 3 minutes, and then ramps down.

To run the k6 script, use the following command:

k6 run bench.js

The script will stop if more than 1% of the requests result in an HTTP error or if the 95th percentile response time exceeds 1 second.

Understanding the Results

The k6 output includes several useful metrics, such as the number of total requests, the number of failed requests, and the average response time. By reviewing these metrics, you can understand how many requests per second your Next.js app can handle on a single DigitalOcean server before it starts to slow down.

Results and Summary

  • The k6 output shows that our server handled 78.9 requests per second (RPS) on average, with a maximum of 50 concurrent users.
  • CPU usage hovered around 63% during the test.
  • Memory usage was constantly at 100%. This indicates that our application is memory-bound.
  • The average response time was 507.82ms.
  • The 95th percentile response time was 793.04ms. This means that 95% of requests were processed within this time, but 5% of requests took longer.
  • No HTTP requests failed, indicating that the server was able to handle the load without dropping requests.

next-on-do-bench's People

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.