{"id":37197390,"url":"https://github.com/spotmaxtech/test-aws-warn-pool","last_synced_at":"2026-01-14T22:56:50.245Z","repository":{"id":70525799,"uuid":"428504281","full_name":"spotmaxtech/test-aws-warn-pool","owner":"spotmaxtech","description":"用户测试热池，开机时间与休眠功能","archived":false,"fork":false,"pushed_at":"2021-11-18T12:49:49.000Z","size":388,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-06-21T18:15:52.629Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/spotmaxtech.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}},"created_at":"2021-11-16T03:29:07.000Z","updated_at":"2023-04-21T11:00:46.000Z","dependencies_parsed_at":null,"dependency_job_id":"4f01ff62-4494-44cf-93d3-85bc62ee9f43","html_url":"https://github.com/spotmaxtech/test-aws-warn-pool","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/spotmaxtech/test-aws-warn-pool","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spotmaxtech%2Ftest-aws-warn-pool","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spotmaxtech%2Ftest-aws-warn-pool/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spotmaxtech%2Ftest-aws-warn-pool/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spotmaxtech%2Ftest-aws-warn-pool/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/spotmaxtech","download_url":"https://codeload.github.com/spotmaxtech/test-aws-warn-pool/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spotmaxtech%2Ftest-aws-warn-pool/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28437472,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T22:37:52.437Z","status":"ssl_error","status_checked_at":"2026-01-14T22:37:31.496Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":[],"created_at":"2026-01-14T22:56:49.158Z","updated_at":"2026-01-14T22:56:50.190Z","avatar_url":"https://github.com/spotmaxtech.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# test-aws-warn-pool\n该程序只用于测试热池，开机时间与休眠功能\n\n# 介绍\n\n云供应商（AWS/阿里云）都提供了spot实例，由于spot实例是Ondemand实例价格的20%左右，相当的便宜，但是用spot不是一帆风顺，当供需不足时就会回收，在AWS会经常遇到大规模的中断，autoScaling伸缩组下的实例补充需要一定的时间，然而由于spot会在中断之前2分钟发出通知，用户很多时候并不能在2分钟内启动机器与添加到autoScaling，并且有效启动App，因此导致业务受影响。\n\n# 官方热池的缺陷\n所谓热池，就是开启一定数量的Ondemand实例放到池子中，然后把实例设置为停止状态，此时云商是不会对实例进行收费，只收EBS的费用。但官方的热池功能只支持单一类型的Ondemand实例，并且不支持混合实例模版，严重影响机器类型的选型使用，提高伸缩组的中断的风险\n\n# 方案\n1、实现云端支持多机型的热池功能，目的在大规模中断来时，快速的从热池中替换中断的机器，保证业务的稳定性\n\n2、因此为了能更快的启动机器内的APP，可以把伸缩组autoScaling中的模板系统盘EBS开启加密状态，保证热池中的实例能开启休眠功能，并且等待唤醒使用，此时APP进程立刻从硬盘加载到内存，加快启动\n\n# 开机数据\n为了验证开热池与不开热池的区别，因此在同一个autoScaling做测试，模拟同时中断10次，中断后实例添加到伸缩组成功的时间\n\n在不开热池的情况下，补充实例的时间最高达到9秒（因为云商对机器数开启的数量的限制，数量越多时间越慢）\n\n![nowarmpool](./img/WX20211117-120356.png)\n\n真实线上数据，最高机器开启时间达到71秒\n\n![nowarmpool](./img/WX20211117-141712.png)\n\n开启热池的情况下，补充实例时间只需要6秒左右（节约时间30%）\n\n![nowarmpool](./img/WX20211117-120427.png)\n\n真实线上数据，最高也只需要10s左右\n\n![nowarmpool](./img/WX20211117-145402.png)\n\n从上面的数据可以得出，热池功能可以快速的补充伸缩组所需的机器，并且有效预防大规模中断\n\n# 休眠数据\n在热池中查看指定某一实例，程序运行时间为11:21:52，App运行的进程id为2281\n\n![nowarmpool](./img/WX20211118-194321.png)\n\n当实例预热成功后，maxGroup为把实例转换停止状态，现在模拟实例中断，添加这台实例到autoScaling,实例从休眠到唤醒都是同一个进程id\n\n![nowarmpool](./img/WX20211118-194743.png)\n\n实例添加到asg时间为11:28:16，休眠起来时间为11:28:21，5秒就能起动App，大大的减少程序的启动时间\n\n![nowarmpool](./img/WX20211118-195255.png)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspotmaxtech%2Ftest-aws-warn-pool","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspotmaxtech%2Ftest-aws-warn-pool","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspotmaxtech%2Ftest-aws-warn-pool/lists"}