{"id":28261760,"url":"https://github.com/proophsoftware/swoole-mongo-test","last_synced_at":"2025-08-27T05:05:05.946Z","repository":{"id":141363176,"uuid":"153885522","full_name":"proophsoftware/swoole-mongo-test","owner":"proophsoftware","description":"Test MongoDB with Swoole","archived":false,"fork":false,"pushed_at":"2018-10-20T13:22:00.000Z","size":5,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-06-16T01:40:37.582Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","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/proophsoftware.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-10-20T08:32:11.000Z","updated_at":"2019-11-20T02:41:55.000Z","dependencies_parsed_at":null,"dependency_job_id":"42ecdfcd-ac18-443f-b522-00a89888af34","html_url":"https://github.com/proophsoftware/swoole-mongo-test","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/proophsoftware/swoole-mongo-test","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/proophsoftware%2Fswoole-mongo-test","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/proophsoftware%2Fswoole-mongo-test/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/proophsoftware%2Fswoole-mongo-test/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/proophsoftware%2Fswoole-mongo-test/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/proophsoftware","download_url":"https://codeload.github.com/proophsoftware/swoole-mongo-test/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/proophsoftware%2Fswoole-mongo-test/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272293520,"owners_count":24908636,"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-08-27T02:00:09.397Z","response_time":76,"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":[],"created_at":"2025-05-20T06:11:46.021Z","updated_at":"2025-08-27T05:05:05.935Z","avatar_url":"https://github.com/proophsoftware.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# swoole-test\n\nTest Swoole Coroutine feature\n\n## Set up\n\n```php\n$ composer install\n$ docker-compose up -d\n```\n\n## How it works\n\nSwoole Http Server runs with one worker only.\n\nIf you hit the server with '/?reg_num=\u003ceven_number\u003e' it will perform a query that sleeps for 10 seconds.\nThis emulates a very slow query.\n\n## Mongo DB\n\nOne Swoole server listens on port `8080`. It uses mongoDB to perform the slow query.\nHitting the server with:\n\n- `http://127.0.0.1:8080/?reg_num=2` takes ~10s due to simulated slow query\n- `http://127.0.0.1:8080/?reg_num=1` Without another active (and blocking) request it is fast, but\nif a request with a slow query is active then this request is blocked until the other one is finished\n\n## PDO MySQL\n\nSecond Swoole server listens on port `8081`. It uses PDO to perform the slow query.\nThere are two db backends available: Postgres and MySql\nIn the `server-pdo.php` file you can set `$useMySql = false;` to let the server use Postgres\ninstead of MySql.\n\nHitting the server with:\n\n- `http://127.0.0.1:8081/?reg_num=2` takes ~10s due to simulated slow query\n- `http://127.0.0.1:8081/?reg_num=1`\n    - MySql: Request is not blocked by other requests, due to Coroutine feature\n    - Postgres: Coroutine feature does not work, so behaviour is similar to MongoDB scenario","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fproophsoftware%2Fswoole-mongo-test","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fproophsoftware%2Fswoole-mongo-test","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fproophsoftware%2Fswoole-mongo-test/lists"}