If you're using AWS Lambda with callbacks, be sure to set context.callbackWaitsForEmptyEventLoop = false in your main handler. Other table types may not behave as expected. NOTE: Transaction support is designed for InnoDB tables (default). If the UPDATE fails, the DELETE will be rolled back. If the record to DELETE doesn't exist, the UPDATE will not be performed. Require and initialize outside of your main handler const mysql = require ( 'serverless-mysql' ) ( ) // optional. It has been tested with AWS's RDS MySQL, Aurora MySQL, and Aurora Serverless. NOTE: This module should work with any standards-based MySQL server. It also dramatically simplifies transactions, giving you a simple and consistent pattern to handle common workflows. In addition, Serverless MySQL also adds modern async/await support to the mysql module, eliminating callback hell or the need to wrap calls in promises. It will clean up zombies, enforce connection limits per user, and retry connections using trusted backoff algorithms. This module constantly monitors the number of connections being utilized, and then based on your settings, manages those connections to allow thousands of concurrent executions to share them. Serverless MySQL adds a connection management component to the mysql module that is designed specifically for use with serverless applications. This is a MAJOR PROBLEM for RDBS solutions like MySQL, because available connections can be quickly maxed out by competing functions. However, serverless functions (like AWS Lambda, Google Cloud Functions, and Azure Functions) scale almost infinitely by creating separate instances for each concurrent user. Normally, using the mysql module with Node apps would be just fine. Serverless MySQL is a wrapper for Doug Wilson's amazing mysql Node.js module. A module for managing MySQL connections at serverless scale.
0 Comments
Leave a Reply. |