epicweb-dev / data-modeling

Model and query your data with confidence
https://www.epicweb.dev
Other
151 stars 61 forks source link

limit prisma connections #7

Closed onemen closed 9 months ago

onemen commented 1 year ago

During some of the workshop i see this message in the terminal [dev:remix] [playground:4000] prisma:info Starting a sqlite pool with 13 connections.

I am using Intel(R) Core(TM) i5-10400 CPU

Here are some quote from 'Bing AI chat:'

The Intel(R) Core(TM) i5-10400 CPU is a 10th generation Intel Core processor with 6 cores and 12 threads. It has a base clock speed of 2.90 GHz and a maximum turbo frequency of 4.30 GHz. This processor is based on the Comet Lake microarchitecture and is built on Intel’s 14nm process technology.

With this processor, the default connection pool size for Prisma Client would be calculated as num_physical_cpus 2 + 1, which in your case would be 6 2 + 1 = 13 connections. This means that if you are using the default connection pool size, you should see 13 connections in the SQLite pool when using Prisma Client.

It is generally not recommended to let any single application consume all of your CPU resources, as this can negatively impact the performance of other applications running on the same machine. Prisma Client is designed to be efficient and make the most of available resources, but it is important to monitor its resource usage and ensure that it does not consume more than its fair share of system resources.

If you are running multiple applications on the same machine, it is a good idea to monitor their resource usage and ensure that no single application is consuming an excessive amount of CPU resources. If you notice that Prisma Client is consuming a large amount of CPU resources, you may want to investigate the cause and take steps to reduce its resource usage. This could include optimizing your queries, reducing the number of concurrent requests, or adjusting the connection pool size.

I don't know if all of the above it true, but i think this is something you should check...

kentcdodds commented 1 year ago

This is just info logging. It's nothing to be concerned with. It's just Prisma letting us know what it's doing.

But maybe we should remove the info log so people don't get confused or worried.

kentcdodds commented 9 months ago

I think this is resolved.