{"id":15914487,"url":"https://github.com/bbengfort/syncwrite","last_synced_at":"2025-08-15T20:33:07.700Z","repository":{"id":69222788,"uuid":"121294661","full_name":"bbengfort/syncwrite","owner":"bbengfort","description":"Throughput study for multiple threads writing to a single synchronized object. ","archived":false,"fork":false,"pushed_at":"2018-02-15T16:42:57.000Z","size":1838,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-27T02:55:25.855Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bbengfort.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":"2018-02-12T19:56:56.000Z","updated_at":"2018-05-28T18:30:08.000Z","dependencies_parsed_at":"2023-04-20T19:32:35.271Z","dependency_job_id":null,"html_url":"https://github.com/bbengfort/syncwrite","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/bbengfort/syncwrite","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbengfort%2Fsyncwrite","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbengfort%2Fsyncwrite/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbengfort%2Fsyncwrite/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbengfort%2Fsyncwrite/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bbengfort","download_url":"https://codeload.github.com/bbengfort/syncwrite/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbengfort%2Fsyncwrite/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270625217,"owners_count":24618345,"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-15T02:00:12.559Z","response_time":110,"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":"2024-10-06T17:03:30.155Z","updated_at":"2025-08-15T20:33:07.680Z","avatar_url":"https://github.com/bbengfort.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Sync Writes\n\n**Throughput study for multiple threads writing to a single synchronized object.**\n\n## Benchmarks\n\nTo run the benchmarks:\n\n```\n$ make bench\n```\n\nYou may have to install dependencies using `godep restore` beforehand. Note that the benchmarks may take a while to run. There are two types of benchmarks: go bench benchmarks the amount of time it takes an operation to run, and throughput benchmarks measure the number of writes per-second.\n\nThe operation benchmarks are as follows:\n\n```\nBenchmarkInMemoryLog-8   \t10000000\t       201 ns/op\nBenchmarkFileLog-8       \t  200000\t      7253 ns/op\nBenchmarkLevelDBLog-8    \t  100000\t     12104 ns/op\n```\n\nThe throughput benchmarks are as follows:\n\n| Throughout (ops/sec)    |     Average |    Smallest |     Largest |   Confidence |\n|-------------------------|------------:|------------:|------------:|-------------:|\n| In-Memory Single Thread | 5253135.838 | 4359456.548 | 5591019.392 | ± 353865.702 |\n| In-Memory 2 Threads     | 6326110.013 | 4587467.827 | 7130902.694 | ± 750315.325 |\n| In-Memory 4 Threads     | 5358033.001 | 4709761.867 | 5770931.862 | ± 313802.803 |\n| In-Memory 8 Threads     | 3630376.542 | 2868603.666 | 4322431.426 | ± 362744.642 |\n| In-Memory 16 Threads    | 3495941.168 | 3030034.735 | 4234283.768 | ± 270080.857 |\n| File Single Thread      |  109835.346 |  107288.465 |  113584.472 |   ± 1841.514 |\n| File 2 Threads          |  106918.977 |   97990.257 |  112586.096 |   ± 3771.965 |\n| File 4 Threads          |   120557.93 |   105184.91 |  146225.469 |  ± 13477.076 |\n| File 8 Threads          |  113074.283 |  109141.601 |  117840.127 |   ± 2544.440 |\n| File 16 Threads         |  109542.505 |  105008.955 |    116745.5 |   ± 2983.509 |\n| LevelDB Single Thread   |   82206.692 |   79553.087 |   83783.706 |   ± 1096.305 |\n| LevelDB 2 Threads       |   82593.469 |   78239.013 |   86354.997 |   ± 1866.427 |\n| LevelDB 4 Threads       |   83295.175 |   80616.994 |   85584.984 |   ± 1459.148 |\n| LevelDB 8 Threads       |   70046.095 |   66340.541 |   71619.628 |   ± 1236.291 |\n| LevelDB 16 Threads      |   68290.992 |   61172.903 |   71260.022 |   ± 2363.267 |\n\nSee details for more information.\n\n## Details\n\nThis library contains several append-only logs that synchronize accesses using `sync.RWMutex`. The log interface is as follows:\n\n```go\ntype Log interface {\n\tOpen(path string) error\n\tAppend(value []byte) error\n\tGet(index int) (*Entry, error)\n\tClose() error\n}\n```\n\nThe `Open`, `Append`, and `Close` methods are all protected by a write lock, and the `Get` method is protected with a read lock. The logs implemented so far are:\n\n- `InMemoryLog`: appends to an in-memory slice and does not write to disk.\n- `FileLog`: on open, reads entries from file into in-memory slice and reads from it, writes append to both the slice and the file.\n- `LevelDBLog`: both writes and reads go to a LevelDB database.\n\n### Benchmarks\n\nThe benchmarks are conducted by running `t` threads, each of which run `n` actions and return the amount of time it takes to run those `n` actions. The write throughput action is simply calling `Write` on the log with `\"foo\"` as the value.\n\nThe total number of operations performed is `n*t` and this is divided by the total number of seconds across all go routines to get the number of operations per second.\n\n**Update** \u0026mdash; the total number of actions `n` has been fixed per measurement, e.g. if a single thread measurement runs 10,000 actions, then the 4 thread measurement will run 2,500 actions per thread.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbbengfort%2Fsyncwrite","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbbengfort%2Fsyncwrite","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbbengfort%2Fsyncwrite/lists"}