{"id":43859802,"url":"https://github.com/aoldershaw/proclimit","last_synced_at":"2026-02-06T09:47:30.152Z","repository":{"id":57502463,"uuid":"224964165","full_name":"aoldershaw/proclimit","owner":"aoldershaw","description":"Resource limits for processes on Linux and Windows","archived":false,"fork":false,"pushed_at":"2019-12-03T17:56:48.000Z","size":18,"stargazers_count":13,"open_issues_count":0,"forks_count":6,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-06-20T00:36:27.712Z","etag":null,"topics":["go","linux","resources","windows"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aoldershaw.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-11-30T05:26:21.000Z","updated_at":"2024-04-15T07:43:02.000Z","dependencies_parsed_at":"2022-09-13T07:02:05.708Z","dependency_job_id":null,"html_url":"https://github.com/aoldershaw/proclimit","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/aoldershaw/proclimit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aoldershaw%2Fproclimit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aoldershaw%2Fproclimit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aoldershaw%2Fproclimit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aoldershaw%2Fproclimit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aoldershaw","download_url":"https://codeload.github.com/aoldershaw/proclimit/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aoldershaw%2Fproclimit/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29157439,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-06T07:18:23.844Z","status":"ssl_error","status_checked_at":"2026-02-06T07:13:32.659Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":["go","linux","resources","windows"],"created_at":"2026-02-06T09:47:29.310Z","updated_at":"2026-02-06T09:47:30.139Z","avatar_url":"https://github.com/aoldershaw.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# proclimit\n\nproclimit is a Go library for running external commands with configurable resource (CPU and memory) limits. \nCurrently, only Linux (cgroups) and Windows (Job Objects) are supported.\n\nThe project also includes an application to run processes with limited resources.\n\n## Installation\n\n```bash\ngo get github.com/aoldershaw/proclimit\n```\n\nTo install and run the application:\n\n```bash\ngo get github.com/aoldershaw/proclimit/cmd/proclimit\n\nproclimit -cpu=50 -memory=512M my-application arg1 arg2\n```\n\n## Usage\n\n```go\nfunc main() {\n    limiter, _ := proclimit.New(\n        // The CPU limit is relative to a single core. Specifying 200% on a 4 core machine\n        // restricts the total CPU usage of all processes in the limiter to use up to 2 cores\n        //\n        // It is not guaranteed that the processes will only be scheduled on 2 physical cores -\n        // in the example above, it is possible that each of the 4 cores will be at 50% utilization\n        // (meaning the total CPU usage is 2 \"full\" cores)\n        proclimit.WithCPULimit(proclimit.Percent(50)),\n        // The memory limit is based on total virtual memory\n        proclimit.WithMemoryLimit(512 * proclimit.Megabyte),\n    )\n    defer limiter.Close()\n\n    // limiter.Command is nearly identical to exec.Command - the returned *Cmd can be treated as an *exec.Cmd\n    // However, when the *Cmd is started (through Start, Run, Output, or CombinedOutput), it will run with\n    // limited resources\n    cmd1 := limiter.Command(\"application1\", \"arg1\", \"arg2\")\n    cmd1.Stdout = os.Stdout\n\n    // application1 will be limited to 512M of virtual memory and 50% of a single core's compute\n    cmd1.Start()\n\n    cmd2 := limiter.Command(\"application2\")\n    \n    // Since application2 is run in the same limiter, the CPU and memory limits apply to the\n    // combined utilization of application1 and application2.\n    // If application1 uses 40% CPU, then application2 can only use up to 10%\n    out, _ := cmd2.Output()\n}\n```\n\n```go\nfunc main() {\n    limiter, _ := proclimit.New(...)\n    ...\n    // proclimit can also limit resources of currently running processes by pid\n    limiter.Limit(1234)\n}\n```\n\n## Note\n\n* proclimit is still very early in development and requires more testing (particularly on the Windows side, as I don't have easy access to a Windows machine).\n* Only Linux and Windows are supported at the moment\n* Processes will first start with no limits applied. If it is important that a process start up with the limits applied (for instance, if using github.com/uber-go/automaxprocs in the application being started), proclimit is currently not the tool for the job.\n\n## License\n[MIT](https://choosealicense.com/licenses/mit/)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faoldershaw%2Fproclimit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faoldershaw%2Fproclimit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faoldershaw%2Fproclimit/lists"}