{"id":23895517,"url":"https://github.com/michimani/lambda-rdb-test","last_synced_at":"2026-05-16T22:04:53.054Z","repository":{"id":115909535,"uuid":"397970874","full_name":"michimani/lambda-rdb-test","owner":"michimani","description":"In this repository, you can try to see how the number of DB connections changes depending on the implementation method when connecting to RDB from Lambda functions implemented in Go.","archived":false,"fork":false,"pushed_at":"2021-08-19T22:03:15.000Z","size":7,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-07-03T09:08:05.438Z","etag":null,"topics":["golang","lambda-functions","mysql","rdb"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/michimani.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-08-19T14:25:54.000Z","updated_at":"2021-08-19T22:03:18.000Z","dependencies_parsed_at":null,"dependency_job_id":"0f814e66-b5f1-4e53-9e3d-4230bd2ccda4","html_url":"https://github.com/michimani/lambda-rdb-test","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/michimani/lambda-rdb-test","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michimani%2Flambda-rdb-test","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michimani%2Flambda-rdb-test/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michimani%2Flambda-rdb-test/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michimani%2Flambda-rdb-test/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/michimani","download_url":"https://codeload.github.com/michimani/lambda-rdb-test/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michimani%2Flambda-rdb-test/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267605999,"owners_count":24114629,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-28T02:00:09.689Z","response_time":68,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["golang","lambda-functions","mysql","rdb"],"created_at":"2025-01-04T15:57:39.801Z","updated_at":"2026-05-16T22:04:53.011Z","avatar_url":"https://github.com/michimani.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"lambda-rdb-test\n===\n\nIn this repository, you can try to see how the number of DB connections changes depending on the implementation method when connecting to RDB from Lambda functions implemented in Go.\n\n# Usage\n\n## Setup containers\n\n```bash\ndocker-compose up -d\n```\n\n```bash\ndocker-compose ps\n```\n\n```\n      Name                    Command             State                          Ports                       \n-------------------------------------------------------------------------------------------------------------\nlambda-rdb          docker-entrypoint.sh mysqld   Up      0.0.0.0:8000-\u003e3306/tcp,:::8000-\u003e3306/tcp, 33060/tcp\nlambda-rdb-func-1   /entry.sh /main               Up      0.0.0.0:8001-\u003e8080/tcp,:::8001-\u003e8080/tcp           \nlambda-rdb-func-2   /entry.sh /main               Up      0.0.0.0:8002-\u003e8080/tcp,:::8002-\u003e8080/tcp           \nlambda-rdb-func-3   /entry.sh /main               Up      0.0.0.0:8003-\u003e8080/tcp,:::8003-\u003e8080/tcp\n```\n\n## Invoke Lambda functions\n\n### Function does not explicitly close the DB connection\n\n```bash\ncurl \"http://localhost:8001/2015-03-31/functions/function/invocations\"\n```\n\nThis Lambda function will increase the number of DB connections each time it is executed. To release the connections, restart the app with the following command.\n\n```bash\ndocker-compose restart lambda1\n```\n\nThis operation will reproduce the state where the AWS Lambda execution environment is replaced.\n\n### Function explicitly closes the DB connection\n\n```bash\ncurl \"http://localhost:8002/2015-03-31/functions/function/invocations\"\n```\n\nThis Lambda function closes the connection after each execution, so no matter how many times it is executed, the number of DB connections will not increase.\n\n### Function reuses the DB connection\n\n```bash\ncurl \"http://localhost:8003/2015-03-31/functions/function/invocations\"\n```\n\nThis Lambda function creates a DB connection only the first time it is started, and reuses the connection created the first time from the second time on. Therefore, the number of DB connections will increase by one.\n\n## Check the number of DB connections\n\n```bash\ndocker exec -it lambda-rdb bash\n```\n\n```bash\nmysql -proot -e'show status like \"Threads_connected\";'\n```\n\n```\n+-------------------+-------+\n| Variable_name     | Value |\n+-------------------+-------+\n| Threads_connected | 1     |\n+-------------------+-------+\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichimani%2Flambda-rdb-test","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmichimani%2Flambda-rdb-test","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichimani%2Flambda-rdb-test/lists"}