Coder Social home page Coder Social logo

accelerate-speed-test's Introduction

Accelerate Speed Test

This app demonstrates the performance benefits of Accelerate, a new Early Access product by Prisma. Accelerate provides a global cache with built-in connection pooling.

The Accelerate Speed Test is a Next.js app using Edge API Routes to serve cached data at the edge. When the speed test begins it will start two concurrent tests, one with cache and one without, that will each run as many sequential Prisma count operations as they can. The results are streamed to the UI and displayed for comparison.

Setup

To run the Accelerate Speed Test locally or deploy it yourself, you'll first need an invitation to Accelerate Early Access. Join the waitlist if you haven't already.

Next, you'll need a database. The Prisma Schema in this repository uses PostgreSQL, but you can substitute it with another database if desired. Create a new Accelerate project for the database to retrieve an Accelerate connection string.

Once you have an Accelerate connection string, create a .env file with DATABASE_URL set to your direct database connection and ACCELERATE_URL set to the Accelerate connection string. This will allow you to push schema changes to your database directly while using Accelerate in the app. Run npx prisma db push to sync the schema changes with your database.

DATABASE_URL="postgresql://..."
ACCELERATE_URL="prisma://accelerate.prisma-data.net..."

You should now be ready to start the app with npm run dev. Since the speed test runs a count operation, it can be helpful to load your database with a number of fake records. We used 500,000 LinkOpen entries, but the performance difference gets more dramatic as the number climbs. The more records you add, the more the database has to work to count them, but cache hits will avoid the database altogether and maintain a consistent latency regardless. The latency is also affected by the app's distance from the database. The cache being at the edge maintains stable performance for cache hits regardless of the database proximity.

accelerate-speed-test's People

Contributors

rtbenfield avatar luanvdw avatar tatianainama avatar ankur-arch avatar janpio avatar jolg42 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.