{"id":13772134,"url":"https://github.com/assafmo/couchdb-linux-performance","last_synced_at":"2026-02-22T22:39:45.947Z","repository":{"id":82611670,"uuid":"89592588","full_name":"assafmo/couchdb-linux-performance","owner":"assafmo","description":"Linux tuning for CouchDB performance","archived":false,"fork":false,"pushed_at":"2019-05-16T08:02:20.000Z","size":14,"stargazers_count":37,"open_issues_count":0,"forks_count":8,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-10-30T06:27:22.407Z","etag":null,"topics":["couchdb","couchdb-performance","linux-tuning"],"latest_commit_sha":null,"homepage":"","language":null,"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/assafmo.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}},"created_at":"2017-04-27T11:59:32.000Z","updated_at":"2024-05-28T18:35:17.000Z","dependencies_parsed_at":null,"dependency_job_id":"9d080de0-3fa3-4c43-b3ab-f3874f8f94dd","html_url":"https://github.com/assafmo/couchdb-linux-performance","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/assafmo/couchdb-linux-performance","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/assafmo%2Fcouchdb-linux-performance","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/assafmo%2Fcouchdb-linux-performance/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/assafmo%2Fcouchdb-linux-performance/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/assafmo%2Fcouchdb-linux-performance/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/assafmo","download_url":"https://codeload.github.com/assafmo/couchdb-linux-performance/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/assafmo%2Fcouchdb-linux-performance/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29730142,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-22T20:09:16.275Z","status":"ssl_error","status_checked_at":"2026-02-22T20:09:13.750Z","response_time":110,"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":["couchdb","couchdb-performance","linux-tuning"],"created_at":"2024-08-03T17:01:00.386Z","updated_at":"2026-02-22T22:39:45.925Z","avatar_url":"https://github.com/assafmo.png","language":null,"funding_links":[],"categories":["Patterns \u0026 Best Practices"],"sub_categories":[],"readme":"# Linux tuning for better CouchDB performance\n\n## Filesystem tuning\n\n### ext4\n\n#### Mount options (or via /etc/fstab)\n\n`errors=remount-ro,noatime,nouser_xattr,barrier=0`\n\n#### Journal\n\n(Replace `sdXY` with your partition name)\n\n##### Check if exists\n\n`sudo tune2fs -l /dev/sdXY | fgrep has_journal`\n\n##### Turn Off/On\n\nUnmount filesystem (If root filesystem then mount read-only) and then:  \n`tune2fs -O ^has_journal /dev/sdXY`\n\n### xfs\n\n#### Mount options (or via /etc/fstab)\n\n`noatime,nodiratime,logbufs=8,logbsize=256k,nobarrier`\n\n## /etc/rc.local\n\n(Replace `sdX` with your device name)\n\n```bash\n####\n## IO Scheduler\n####\n\n# First, set an appropriate IO scheduler for file servers.\n# deadline - For spinning disks\n# noop     - For VMs and SSDs\necho noop \u003e /sys/block/sdX/queue/scheduler\n\n# Now give the IO scheduler more flexibility by increasing the number of schedulable requests:\necho 4096 \u003e /sys/block/sdX/queue/nr_requests\n\n# To improve throughput for sequential reads, increase the maximum amount of read-ahead data.\n# The actual amount of read-ahead is adaptive,\n# so using a high value here won't harm performance for small random access.\necho 4096 \u003e /sys/block/sdX/queue/read_ahead_kb\n\n####\n## Virtual memory settings\n####\n\n# To avoid long IO stalls (latencies) for write cache flushing\n# in a production environment with very different workloads,\n# you will typically want to limit the kernel dirty (write) cache size:\necho 5 \u003e /proc/sys/vm/dirty_background_ratio\necho 10 \u003e /proc/sys/vm/dirty_ratio\n\n# Assigning slightly higher priority to inode caching helps\n# to avoid disk seeks for inode loading:\necho 50 \u003e /proc/sys/vm/vfs_cache_pressure\n\n# Decrease swappiness to prevent swapping as much as possible\necho 1 \u003e /proc/sys/vm/swappiness\n\n# Buffering of file system data requires frequent memory allocation.\n# Raising the amount of reserved kernel memory will enable faster and more reliable\n# memory allocation in critical situations.\n# Raise the corresponding value to 64MB if you have less than 8GB of memory,\n# otherwise raise it to at least 256MB:\necho 262144 \u003e /proc/sys/vm/min_free_kbytes\n\n# It is recommended to have transparent huge pages disabled:\necho madvise \u003e /sys/kernel/mm/transparent_hugepage/enabled\n\n####\n## Process scheduler\n####\n\n# There's a kernel parameter that determines how long a migrated process has to be running\n# before the kernel will consider migrating it again to another core.\n# The sysctl name is sched_migration_cost_ns, default value 50000 (that's ns so 0.5 ms).\n# Forking servers, like PostgreSQL or Apache, scale to much higher levels of concurrent\n# connections if this is made larger, by at least an order of magnitude:\necho 5000000 \u003e /proc/sys/kernel/sched_migration_cost_ns\n\n# Another parameter that can dramatically impact forking servers is sched_autogroup_enabled.\n# This setting groups tasks by TTY, to improve perceived responsiveness on an interactive system.\n# On a server with a long running forking daemon, this will tend to keep child processes from\n# migrating away as soon as they should.\n# It can be disabled like so:\necho 0 \u003e /proc/sys/kernel/sched_autogroup_enabled\n\n####\n## CPU\n####\n\n# Set the scaling governor to performance. This keeps the CPU at maximum frequency\necho performance | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor\n```\n\n### Apply the changes\n\n`sudo /etc/rc.local` or `reboot`\n\n## ionice\n\n:warning: Using `ionice` is effective if and only if IO scheduler uses an algorithm that takes\npriorities into account. If you have followed this guide so far, using `ionice` will have no effect\nsince you have set IO Scheduler to `deadline` or `noop` which doesn't use priorities.\nLook for `cfq` for a scheduler that works with priorities.\n\nGiving CouchDB IO priority with `ionice`: `sudo ionice -p $(pidof beam.smp) -c 1 -n 0`.  \nThis can also be done in a [`systemd` unit](https://gist.github.com/SinanGabel/eac83a2f9d0ac64e2c9d4bd936be9313/3d302ee7b2667b70c8372e4f6ce4891811f2fb94#file-couchdb-2-0-install-L116):\n\n```\nIOSchedulingClass=1\nIOSchedulingPriority=0\n```\n\n## Sources:\n\n- https://www.beegfs.com/wiki/StorageServerTuning\n- https://tweaked.io/guide/kernel/\n- https://developer.couchbase.com/documentation/server/current/install/install-swap-space.html\n- http://www.tutorialspoint.com/unix_commands/ionice.htm\n- https://www.freedesktop.org/software/systemd/man/systemd.exec.html\n- https://blog.nelhage.com/post/transparent-hugepages/\n- https://www.kernel.org/doc/Documentation/cpu-freq/governors.txt\n- https://blog.codeship.com/linux-io-scheduler-tuning/\n- https://askubuntu.com/a/784504\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fassafmo%2Fcouchdb-linux-performance","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fassafmo%2Fcouchdb-linux-performance","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fassafmo%2Fcouchdb-linux-performance/lists"}