Skip to main content

超越 Prisma ORM

作为 Prisma ORM 用户,你已经体验到了类型安全数据库查询和直观数据建模的强大功能。但是,在扩展生产应用时,会出现新的挑战。随着应用的成熟,你将开始体验连接池的复杂性或找到有效缓存常见查询的方法。

¥As a Prisma ORM user, you're already experiencing the power of type-safe database queries and intuitive data modeling. When scaling production applications, however, new challenges emerge. As an app matures it’s a given that you’ll begin to experience connection pooling complexities or find ways to effectively cache common queries.

与其花费宝贵的时间来克服这些挑战,不如让我们来探索一下 Prisma 如何通过随着应用的增长扩展 ORM 的功能来提供帮助。

¥Instead of spending your valuable time overcoming these challenges, let’s explore how Prisma can help by extending the capabilities of the ORM as your application grows.

使用 Prisma Accelerate 提升应用性能

¥Boost application performance with Prisma Accelerate

随着应用的扩展,你可能需要工具来有效处理增加的流量。这通常涉及实现连接池来管理数据库连接和缓存策略以减少数据库负载并缩短响应时间。Prisma Accelerate 通过单一解决方案满足了这些需求,无需设置和管理单独的基础架构。

¥As your application scales, you'll likely need tools to handle increased traffic efficiently. This often involves implementing connection pooling to manage database connections and caching strategies to reduce database load and improve response times. Prisma Accelerate addresses these needs in a single solution, eliminating the need to set up and manage separate infrastructure.

Prisma Accelerate 对于部署到无服务器和边缘环境(也称为函数即服务)的应用特别有用,因为这些部署比传统的长寿命应用更容易创建多个数量级的连接。对于这些应用,Prisma Accelerate 具有额外的好处,可以从第一天开始保护你的数据库并保持你的应用在线 无论你遇到什么流量

¥Prisma Accelerate is particularly useful for applications deployed to serverless and edge environments (also know as Function-as-a-Service) because these deployments lend themselves towards many orders of magnitude more connections being created than a traditional, long-lived application. For these apps, Prisma Accelerate has the added benefit of protecting your database from day one and keeping your app online regardless of traffic you experience.

试用 加速速度测试 以了解可能的情况。

¥Try out the Accelerate speed test to see what’s possible.

使用连接池提高查询性能

¥Improve query performance with connection pooling

将你的连接池放置在 15 个以上的全球区域之一中,最大限度地减少数据库操作的延迟。在无服务器和边缘环境中启用高性能分布式工作负载。

¥Place your connection pooler in one of 15+ global regions, minimizing latency for database operations. Enable high-performance distributed workloads across serverless and edge environments.

使用缓存减少查询延迟和数据库负载

¥Reduce query latency and database load with caching

在全球 300 多个接入点缓存查询结果。Accelerate 扩展了你的 Prisma 客户端,提供直观、精细的缓存模式控制,例如基于每个查询的 ttlswr

¥Cache query results across 300+ global points of presence. Accelerate extends your Prisma Client, offering intuitive, granular control over caching patterns such as ttl and swr on a per-query basis.

使用托管基础设施处理扩展流量

¥Handle scaling traffic with managed infrastructure

无需更改基础设施即可扩展到每天数百万个查询。高效管理数据库连接并以更少的资源为更多用户提供服务。

¥Scale to millions of queries per day without infrastructure changes. Efficiently manage database connections and serve more users with fewer resources.

立即开始使用 Accelerate

¥Get started with Accelerate today

Accelerate 通过 @prisma/extension-accelerate 客户端扩展与你的 Prisma ORM 项目无缝集成。使用我们的 设置指南 快速入门,并立即访问完整的边缘环境支持、连接池和全局缓存。

¥Accelerate integrates seamlessly with your Prisma ORM project through the @prisma/extension-accelerate client extension. Get started quickly with our setup guide and instantly access full edge environment support, connection pooling, and global caching.

import { PrismaClient } from '@prisma/client'
import { withAccelerate } from '@prisma/extension-accelerate'

// 1. Extend your Prisma Client with the Accelerate extension
const prisma = new PrismaClient().$extends(withAccelerate())

// 2. (Optionally) add cache to your Prisma queries
const users = await prisma.user.findMany({
cacheStrategy: {
ttl: 30, // Consider data fresh for 30 seconds
swr: 60 // Serve stale data for up to 60 seconds while fetching fresh data
}
})

要查看更多示例,请访问我们的 示例 repo 或使用 npx try-prisma 亲自尝试。

¥To see more examples, visit our examples repo or try them out yourself with npx try-prisma.

¥

与 Prisma 一起成长

¥Grow with Prisma

Prisma Accelerate 采用 Prisma ORM 内置的功能,并通过添加全局优化缓存和连接池等额外功能来构建它们。免费开始使用 ,探索 Accelerate 如何帮助你构建可扩展的高性能应用!

¥Prisma Accelerate take features built into Prisma ORM and build upon them by adding additional capabilities like globally-optimized caching and connection pooling. Get started for free the and explore how Accelerate can help you build scalable, high-performance applications!

改善开发者体验并不止于加速。Prisma 正在构建和扩展我们的产品,例如 Prisma 优化Prisma Postgres,以改进 Data DX 的各个方面,我们很乐意听到你的想法。加入我们的社区,在下面详细了解我们的产品。

¥Improving developer experience doesn’t stop at Accelerate. Prisma is building and expanding our products, such as Prisma Optimize and Prisma Postgres, to improve every aspect of Data DX and we’d love to hear what you think. Join our community and learn more about our products below.

通过 Prisma 客户端扩展 在 Prisma ORM 上加速和优化构建。这将开启我们无法在 ORM 中包含的功能,例如全局优化缓存和连接池。创建一个免费的 账户并探索 Accelerate 如何帮助你构建可扩展的高性能应用!

¥Accelerate and Optimize build on Prisma ORM through Prisma Client Extensions. This opens up features that we couldn’t include in the ORM like globally-optimized caching and connection pooling. Create a free account and explore how Accelerate can help you build scalable, high-performance applications!

改善开发者体验并不止于 Prisma Postgres、加速和优化。Prisma 正在构建和扩展我们的产品以改进 Data DX 的各个方面,我们很乐意听到你的想法。加入我们的社区,在下面详细了解我们的产品

¥Improving developer experience doesn’t stop at Prisma Postgres, Accelerate and Optimize. Prisma is building and expanding our products to improve every aspect of Data DX and we’d love to hear what you think. Join our community and learn more about our products below