{"id":16367859,"url":"https://github.com/nkonev/companies","last_synced_at":"2026-02-22T00:30:16.279Z","repository":{"id":65903018,"uuid":"588157869","full_name":"nkonev/companies","owner":"nkonev","description":"Company example with DoltDB versioned database","archived":false,"fork":false,"pushed_at":"2024-01-12T03:00:06.000Z","size":145,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-31T04:12:59.594Z","etag":null,"topics":["dolt","doltdb"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nkonev.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}},"created_at":"2023-01-12T13:17:14.000Z","updated_at":"2024-03-27T17:16:49.000Z","dependencies_parsed_at":"2024-01-12T07:00:15.446Z","dependency_job_id":"49b79d1e-dfec-4c31-bc8e-3ce8d5fdd6aa","html_url":"https://github.com/nkonev/companies","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nkonev%2Fcompanies","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nkonev%2Fcompanies/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nkonev%2Fcompanies/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nkonev%2Fcompanies/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nkonev","download_url":"https://codeload.github.com/nkonev/companies/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239851926,"owners_count":19707616,"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","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":["dolt","doltdb"],"created_at":"2024-10-11T02:51:02.333Z","updated_at":"2026-02-22T00:30:16.240Z","avatar_url":"https://github.com/nkonev.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Play with companies and drafts\n```bash\ncurl -Ss -H 'X-Userid: c092a0ad-8148-4291-9194-6c3d12a1120a' -H 'Content-Type: application/json' -X POST -d '{\"name\": \"Third company\", \"metadata\": {\"a\": \"b\", \"c\": 1}}' --url 'http://localhost:8080/company' | jq '.'\n\ncurl -Ss --url 'http://localhost:8080/company' | jq '.'\n\ncurl -Ss --url 'http://localhost:8080/company/d776630f-9dd1-41e0-b2b7-b4077a40cb84'\n\ncurl -Ss -H 'X-Userid: c092a0ad-8148-4291-9194-6c3d12a1120a' -H 'Content-Type: application/json' -X POST --url 'http://localhost:8080/company/d776630f-9dd1-41e0-b2b7-b4077a40cb84/draft' | jq '.'\n\ncurl -Ss --url 'http://localhost:8080/company/d776630f-9dd1-41e0-b2b7-b4077a40cb84/drafts' | jq '.'\n\ncurl -Ss -H 'X-Userid: c092a0ad-8148-4291-9194-6c3d12a1120a' -H 'Content-Type: application/json' -X PUT -d '{\"message\": \"Patch note\", \"company\": { \"name\": \"Third company patched 100505\"}}' --url 'http://localhost:8080/company/d776630f-9dd1-41e0-b2b7-b4077a40cb84/draft/88b03065-71cd-4a6d-b717-78f779402a8b' | jq '.'\n\ncurl -Ss -H 'X-Userid: c092a0ad-8148-4291-9194-6c3d12a1120a' -H 'Content-Type: application/json' -X PUT -d '{\"message\": \"Approve note\"}' --url 'http://localhost:8080/company/d776630f-9dd1-41e0-b2b7-b4077a40cb84/draft/88b03065-71cd-4a6d-b717-78f779402a8b/approve' | jq '.'\n\n```\n\n# Load testing\n\n## 50000 branches\n```\ndocker-compose up -d\n./mvnw -DenableLoadTests=true -Dtest=\"name.nkonev.examples.companies.VolumeTest#fifty_thousand_branches\" test\n```\n\n\n## Create 7000 companies, then add a commit to every company three times\n### Run web app in the first terminal window\n```\n./mvnw spring-boot:run\n```\n\n### Then create 7000 companies th another terminal\n```\n./mvnw -DenableLoadTests=true -Dtest=\"name.nkonev.examples.companies.VolumeTest#seven_thousand_companies\" test\n```\n\n### Then create branch for every company three times (sequentially)\n```\n./mvnw -DenableLoadTests=true -Dtest=\"name.nkonev.examples.companies.VolumeTest#create_draft_for_each_company\" test\n./mvnw -DenableLoadTests=true -Dtest=\"name.nkonev.examples.companies.VolumeTest#create_draft_for_each_company\" test\n./mvnw -DenableLoadTests=true -Dtest=\"name.nkonev.examples.companies.VolumeTest#create_draft_for_each_company\" test\n```\n\n### Then run every-second requests in three terminal windows in parallel\n```\nwatch -n 1 curl -Ss --url 'http://localhost:8080/company'\n```\n\n```\nwatch -n 1 curl -Ss --url 'http://localhost:8080/company'\n```\n\n```\nwatch -n 1 curl -Ss --url 'http://localhost:8080/company'\n```\n\nThose requests turned into SQL like\n```sql\nCALL DOLT_CHECKOUT ('main');\nSELECT `company`.`name` AS `name`, `company`.`modified_at` AS `modified_at`, `company`.`id` AS `id`, `company`.`bank_account` AS `bank_account`, `company`.`estimated_size` AS `estimated_size` FROM `company` ORDER BY `company`.`name` ASC LIMIT 0, 20\n```\n\n(You can uncomment JDBC logging in `application.yaml`)\n\nNow we can see 20% CPU of dolt in `top`.\n\nI tried to create indexes\n```sql\nALTER TABLE company\n    ADD INDEX company_name USING HASH (name);\n\nALTER TABLE company\n    ADD INDEX company_name USING BTREE (name);\n```\nbut it doesn't change the CPU load.\n\n\n### If we start creating branches again CPU of dolt will be 120%\n```\n./mvnw -DenableLoadTests=true -Dtest=\"name.nkonev.examples.companies.VolumeTest#create_draft_for_each_company\" test\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnkonev%2Fcompanies","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnkonev%2Fcompanies","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnkonev%2Fcompanies/lists"}