Next.js high connection count with SSG

18 Views Asked by At

I have a nextjs site with about 7800 product pages. The site runs completely fine when I have the product pages setup as SSR with getServerSideProps. However, if I switch them to ISR, I quickly run into mysql max connections error even well after the app is fully built and deployed.

Using sequelize with this pool config: { max: 3, min: 0, idle: 5 * 1000, evict: 1000, acquire: 30 * 1000 }

getStaticPaths returns about 7800 paths for product pages. getStaticProps has about 5 different database calls. revalidate set to 24 hours

Like I said, same functions run fine if I just use SSR (<40 connections total), but even just navigating only a few products with SSG, it overloads max_connections for mysql which is 150.

I expected some significant increase in usage during build time since SSG has to build all the pages ahead of time, but after that the usage should have been comparable.

0

There are 0 best solutions below