All Projects → assafmo → couchdb-linux-performance

assafmo / couchdb-linux-performance

Licence: MIT License
Linux tuning for CouchDB performance

Projects that are alternatives of or similar to couchdb-linux-performance

go-pouchdb
GopherJS bindings for PouchDB ⚠️ NOTICE ⚠️ this package has been superseded by https://github.com/go-kivik/kivik
Stars: ✭ 12 (-60%)
Mutual labels:  couchdb
react-pouchdb
React components for interacting with PouchDB.
Stars: ✭ 15 (-50%)
Mutual labels:  couchdb
pzgps
Read GPS data from a PiZero in a single page web app via a WebSocket
Stars: ✭ 12 (-60%)
Mutual labels:  couchdb
couchdb dart
A library for Dart developers for work with CouchDB
Stars: ✭ 47 (+56.67%)
Mutual labels:  couchdb
couchdb-prometheus-exporter
CouchDB stats exporter for Prometheus
Stars: ✭ 45 (+50%)
Mutual labels:  couchdb
couchwarehouse
Data warehouse for CouchDB
Stars: ✭ 41 (+36.67%)
Mutual labels:  couchdb
couch-auth
Powerful authentication for APIs and apps using CouchDB (or Cloudant) with Node >= 14
Stars: ✭ 50 (+66.67%)
Mutual labels:  couchdb
couchbackup
CouchDB backup and restore command-line utility.
Stars: ✭ 15 (-50%)
Mutual labels:  couchdb
couchdb-mango
Mirror of Apache CouchDB Mango
Stars: ✭ 34 (+13.33%)
Mutual labels:  couchdb
Sessel
Document RDFizer for CouchDB
Stars: ✭ 22 (-26.67%)
Mutual labels:  couchdb
hospitalrun-core
All elements shared between Frontend and Backend, including CouchDB design-documents and schemas.
Stars: ✭ 36 (+20%)
Mutual labels:  couchdb
couchdb-couch-plugins
Mirror of Apache CouchDB
Stars: ✭ 14 (-53.33%)
Mutual labels:  couchdb
bitnami-docker-couchdb
Bitnami Docker Image for CouchDB
Stars: ✭ 15 (-50%)
Mutual labels:  couchdb
sohva
CouchDB asynchronous client for Scala
Stars: ✭ 21 (-30%)
Mutual labels:  couchdb
flycouchdb
Migration tool for CouchDB
Stars: ✭ 20 (-33.33%)
Mutual labels:  couchdb
framework
Solu Framework is a full featured, ORM-backed, isomorphic framework using RPython, Pouch/CouchDB and React.
Stars: ✭ 20 (-33.33%)
Mutual labels:  couchdb
preserver-plus
Minimal notes app
Stars: ✭ 34 (+13.33%)
Mutual labels:  couchdb
rpi-couchdb
CouchDB Docker 🐳 for Raspberry Pi. Part of OLE's Treehouses Project.
Stars: ✭ 30 (+0%)
Mutual labels:  couchdb
couchdb-operator
prototype kubernetes operator for couchDB
Stars: ✭ 17 (-43.33%)
Mutual labels:  couchdb
Ionic-CouchDB-chat-app
Simple chat mobile app, like whatsApp lite version
Stars: ✭ 13 (-56.67%)
Mutual labels:  couchdb

Linux tuning for better CouchDB performance

Filesystem tuning

ext4

Mount options (or via /etc/fstab)

errors=remount-ro,noatime,nouser_xattr,barrier=0

Journal

(Replace sdXY with your partition name)

Check if exists

sudo tune2fs -l /dev/sdXY | fgrep has_journal

Turn Off/On

Unmount filesystem (If root filesystem then mount read-only) and then:
tune2fs -O ^has_journal /dev/sdXY

xfs

Mount options (or via /etc/fstab)

noatime,nodiratime,logbufs=8,logbsize=256k,nobarrier

/etc/rc.local

(Replace sdX with your device name)

####
## IO Scheduler
####

# First, set an appropriate IO scheduler for file servers.
# deadline - For spinning disks
# noop     - For VMs and SSDs
echo noop > /sys/block/sdX/queue/scheduler

# Now give the IO scheduler more flexibility by increasing the number of schedulable requests:
echo 4096 > /sys/block/sdX/queue/nr_requests

# To improve throughput for sequential reads, increase the maximum amount of read-ahead data.
# The actual amount of read-ahead is adaptive,
# so using a high value here won't harm performance for small random access.
echo 4096 > /sys/block/sdX/queue/read_ahead_kb

####
## Virtual memory settings
####

# To avoid long IO stalls (latencies) for write cache flushing
# in a production environment with very different workloads,
# you will typically want to limit the kernel dirty (write) cache size:
echo 5 > /proc/sys/vm/dirty_background_ratio
echo 10 > /proc/sys/vm/dirty_ratio

# Assigning slightly higher priority to inode caching helps
# to avoid disk seeks for inode loading:
echo 50 > /proc/sys/vm/vfs_cache_pressure

# Decrease swappiness to prevent swapping as much as possible
echo 1 > /proc/sys/vm/swappiness

# Buffering of file system data requires frequent memory allocation.
# Raising the amount of reserved kernel memory will enable faster and more reliable
# memory allocation in critical situations.
# Raise the corresponding value to 64MB if you have less than 8GB of memory,
# otherwise raise it to at least 256MB:
echo 262144 > /proc/sys/vm/min_free_kbytes

# It is recommended to have transparent huge pages disabled:
echo madvise > /sys/kernel/mm/transparent_hugepage/enabled

####
## Process scheduler
####

# There's a kernel parameter that determines how long a migrated process has to be running
# before the kernel will consider migrating it again to another core.
# The sysctl name is sched_migration_cost_ns, default value 50000 (that's ns so 0.5 ms).
# Forking servers, like PostgreSQL or Apache, scale to much higher levels of concurrent
# connections if this is made larger, by at least an order of magnitude:
echo 5000000 > /proc/sys/kernel/sched_migration_cost_ns

# Another parameter that can dramatically impact forking servers is sched_autogroup_enabled.
# This setting groups tasks by TTY, to improve perceived responsiveness on an interactive system.
# On a server with a long running forking daemon, this will tend to keep child processes from
# migrating away as soon as they should.
# It can be disabled like so:
echo 0 > /proc/sys/kernel/sched_autogroup_enabled

####
## CPU
####

# Set the scaling governor to performance. This keeps the CPU at maximum frequency
echo performance | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor

Apply the changes

sudo /etc/rc.local or reboot

ionice

⚠️ Using ionice is effective if and only if IO scheduler uses an algorithm that takes priorities into account. If you have followed this guide so far, using ionice will have no effect since you have set IO Scheduler to deadline or noop which doesn't use priorities. Look for cfq for a scheduler that works with priorities.

Giving CouchDB IO priority with ionice: sudo ionice -p $(pidof beam.smp) -c 1 -n 0.
This can also be done in a systemd unit:

IOSchedulingClass=1
IOSchedulingPriority=0

Sources:

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].