Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Performance results #45

Open
chainhead opened this issue Aug 2, 2019 · 7 comments
Open

Performance results #45

chainhead opened this issue Aug 2, 2019 · 7 comments
Labels
help wanted Extra attention is needed

Comments

@chainhead
Copy link

@jeremydaly great project! Do you have some benchmark reports that show a before-and-after comparison?

@jeremydaly
Copy link
Owner

Hi @chainhead,

I'm sure I do, but I'll need to dig for them. It would be a great independent side project to run some performance tests. I'd be happy to include anyone's results if they want to share.

Jeremy

@jeremydaly jeremydaly added the help wanted Extra attention is needed label Aug 28, 2019
@trademark18
Copy link

@jeremydaly Can you shed some informal light on the performance of this package vs. the Data API? In my tests (which are not terribly scientific) it seems like the Data API may be a little bit slower than I hoped, maybe due to overhead. Would this be more performant, generally speaking?

@jeremydaly
Copy link
Owner

Hi @trademark18! This package is typically more performant than the Data API, but it requires a more complex environment setup (e.g. VPC, security groups, etc.). This library uses the mysql or mysql2 package behind the scenes, so the protocol is super fast as opposed to the HTTP-based Data API. The choice comes down to what your requirements are. Hope that helps.

@trademark18
Copy link

@jeremydaly Thanks for the quick response. I suspected this was the case. I think the complexity would will be there anyway for this project, so I may give this a go for the performance gain. I have up to millions of Lambdas invocations per day, so keeping them quick saves $$!

I suppose we can assume that the connection management efficiency is roughly equivalent between Data API and serverless-mysql. I guess that would be the only other consideration.

By the way, thanks for the excellent blog posts and research on Aurora Serverless! I'm considering a migration from MSSQL on RDS and these resources have been most helpful.

@canhnht
Copy link

canhnht commented Oct 18, 2021

Hi @jeremydaly, I'm encountering an issue in performance.
I'm using serverless-mysql and knex-serverless-mysql.
I'm running MySQL Aurora instance.
Before using serverless-mysql, my database has 1 primary and 1 reader replica.
Since using serverless-mysql, I noticed a few things:

  • Number of RDS reader replicas increase from 1 instance to 2 instances, and today it increases up to 3 instances. Number of connections are increasing from 100 to 400. Probably because of high number of connections, it caused number of RDS reader replicas to increase.
  • Lambda functions encountered more timeout errors. It's probably because of number of connections to RDS instances are high, so creating connections take more time.
  • Lambda functions also encountered another error like this
Error: ER_OUT_OF_RESOURCES: Out of memory; check if mysqld or some other process uses all available memory; if not, you may have to use 'ulimit' to allow mysqld to use more memory or you can add more swap space

After removing serverless-mysql and adding back RDS proxy, the above issues are resolved:

  • Number of connections in RDS decreases from 400 to 100.
  • Number of reader replicas decreases from 3 instances to 1 instance.
  • Lambda functions do not have above 2 errors anymore.

When implementing serverless-mysql, my lambda functions is async function and end by calling context.done(). I also added context.callbackWaitsForEmptyEventLoop = false;.

Is there something wrong with my implementation of serverless-mysql? Or it's a problem in serverless-mysql?
Thanks a lot!

@canhnht
Copy link

canhnht commented Nov 8, 2021

Hi @jeremydaly, can you take a look at this issue? I really want to replace RDS proxy by serverless-mysql, so that the cost can be reduced. But it seems like serverless-mysql is not helping.
Thanks in advance.

@Markkos89
Copy link

Hi @chainhead @canhnht, I believe that this issues you guys are having is related to cold starts and, thank god, Jeremy wrote about this in an article in his own page, to give some of his own insight, experience, and thoughts about cold starts, it's really a great article to read and I personally recommend it.

The great thing is that later, a few months after that post, he wrote another great article (I also recommend to read) with a proper solution for cold starts issues, wich ended up in a new npm package he also created, called lambda-warmer.

I hope this is related to your issues and hopefully the links will help you guys.

I'm about to try it in a PoC i'm building.

Lastly, a big thanks to you, @jeremydaly!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

5 participants