{"id":2102,"date":"2011-12-16T17:38:24","date_gmt":"2011-12-16T15:38:24","guid":{"rendered":"http:\/\/skeletor.org.ua\/?p=2102"},"modified":"2025-05-20T16:17:32","modified_gmt":"2025-05-20T13:17:32","slug":"%d1%82%d1%8e%d0%bd%d0%b8%d0%bd%d0%b3-zfs-%d0%bf%d0%be%d0%b4-%d1%80%d0%b0%d0%b7%d0%bd%d1%8b%d0%b5-%d0%b7%d0%b0%d0%b4%d0%b0%d1%87%d0%b8","status":"publish","type":"post","link":"https:\/\/skeletor.org.ua\/?p=2102","title":{"rendered":"\u0422\u044e\u043d\u0438\u043d\u0433 zfs \u043f\u043e\u0434 \u0440\u0430\u0437\u043d\u044b\u0435 \u0437\u0430\u0434\u0430\u0447\u0438"},"content":{"rendered":"<p>\u0411\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445, web \u0441\u0435\u0440\u0432\u0435\u0440\u0430<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 <strong>mysql+memcached<\/strong>, \u0442\u043e \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0434\u0432\u043e\u0439\u043d\u043e\u0433\u043e \u043a\u0435\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f: <strong>zfs<\/strong> \u0438 <strong>memcached<\/strong> &#8211; \u043a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437 \u043d\u0438\u0445 \u043a\u0435\u0448\u0438\u0440\u0443\u0435\u0442. \u0412\u044b\u0445\u043e\u0434 \u043e\u0434\u0438\u043d: \u0440\u0430\u0437\u0440\u0435\u0448\u0438\u0442\u044c \u043a\u0435\u0448\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0435.<\/p>\n<p>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u043e\u0431\u043e\u0438\u0445 \u0441\u0432\u043e\u0439\u0441\u0442\u0432 \u2013\u00a0<strong><tt>all<\/tt><\/strong>,\u00a0<strong><tt>none<\/tt><\/strong>\u00a0\u0438\u00a0<strong><tt>metadata<\/tt><\/strong>. \u041f\u0440\u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435 \u043d\u0430\u00a0<strong><tt>all<\/tt><\/strong>\u00a0\u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0438 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0445. \u041f\u0440\u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435 \u043d\u0430\u00a0<tt>none<\/tt>\u00a0\u043a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0438 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f. \u041f\u0440\u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435 \u043d\u0430\u00a0<strong><tt>metadata<\/tt><\/strong>\u00a0\u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0445. \u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f\u00a0<strong><tt>all<\/tt><\/strong>.<\/p>\n<p><!--more--><br \/>\n<code>#zfs set primarycache=metadata database\/mysql<br \/>\n#zfs set secondarycache=none database\/mysql<\/code><\/p>\n<p>\u0422\u0430\u043a \u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0435\u0449\u0451 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c<\/p>\n<p><code>#zfs set logbias=throughput database\/mysql<\/code><\/p>\n<p>\u0430 \u0434\u043b\u044f \u0436\u0443\u0440\u043d\u0430\u043b\u043e\u0432 \u0411\u0414 <strong>mysql<\/strong> \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0435\u0449\u0451<\/p>\n<p><code>#zfs set logbias=latency\u00a0database\/mysql_logs<\/code><\/p>\n<p>\u0418 \u0437\u0430\u043e\u0434\u043d\u043e \u0442\u0430\u043a \u0436\u0435 \u043e\u0442\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u044d\u0442\u043e \u0447\u0435\u0440\u0435\u0437 <strong>mysql<\/strong> (\u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0443 \u0432 <strong>my.cnf<\/strong>):<\/p>\n<p><code>skip-innodb_doublewrite<\/code><\/p>\n<p>\u0422\u0430\u043a \u0436\u0435 \u043d\u0435\u043c\u0430\u043b\u043e\u0432\u0430\u0436\u043d\u044b\u043c \u0444\u0430\u043a\u0442\u043e\u0440\u043e\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 <strong>noatime<\/strong> \u0434\u043b\u044f \u0424\u0421.<\/p>\n<p><code>#zfs set atime=off database\/mysql<\/code><\/p>\n<p><strong>InnoDB<\/strong> \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 \u0444\u0430\u0439\u043b\u043e\u043c \u0434\u0430\u043d\u043d\u044b\u0445 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0430\u043c\u0438 \u043f\u043e <strong>16KB<\/strong>, \u043f\u043e\u043a\u0430 \u0432\u044b \u043d\u0435 \u043f\u0435\u0440\u0435\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u0442\u0435 \u0435\u0433\u043e \u0441 \u0434\u0440\u0443\u0433\u0438\u043c \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b. \u0412\u0430\u0436\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c <strong>ZFS<\/strong> <strong>recordsize<\/strong> \u0440\u0430\u0432\u043d\u044b\u043c \u0440\u0430\u0437\u043c\u0435\u0440\u0443 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b. \u042d\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u0431\u0443\u0434\u0443\u0442 \u0441\u043e\u0437\u0434\u0430\u043d\u044b \u043a\u0430\u043a\u0438\u0435 \u043b\u0438\u0431\u043e \u0444\u0430\u0439\u043b\u044b \u0432 \u0440\u0430\u0437\u0434\u0435\u043b\u0435 (\u044d\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u0424\u0421 \u0441 \u0431\u0430\u0437\u043e\u0439, \u043d\u043e \u0438 \u043d\u0430 \u0424\u0421 \u0441 \u043b\u043e\u0433\u0430\u043c\u0438)<\/p>\n<p><code>#zfs set recordsize=16K database\/mysql<\/code><\/p>\n<p>\u0410 \u0434\u043b\u044f \u0436\u0443\u0440\u043d\u0430\u043b\u043e\u0432 \u043b\u0443\u0447\u0448\u0435 \u0441\u0442\u0430\u0432\u0438\u0442\u044c <strong>128\u041a<\/strong><\/p>\n<p><code>zfs set recordsize=128K\u00a0database\/mysql_logs<\/code><\/p>\n<p>\u0423\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u0435 \u043b\u0438\u043c\u0438\u0442\u0430 \u043d\u0430 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0444\u0430\u0439\u043b\u043e\u0432\u044b\u0445 \u0434\u0435\u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0440\u043e\u0432 \u0442\u043e\u0436\u0435 \u0432\u043b\u0438\u044f\u0435\u0442 \u043d\u0430 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c (\u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u0442\u0440\u043e\u043a\u0438 \u0432 <strong>\/etc\/system<\/strong> \u0438 \u043f\u0435\u0440\u0435\u0433\u0440\u0443\u0436\u0430\u0435\u043c\u0441\u044f)<\/p>\n<p><code># Hard limit on the file descriptors for a single process<br \/>\nset rlim_fd_max = 260000<br \/>\n# Soft limit on the file descriptors for a single process<br \/>\nset rlim_fd_cur = 260000<\/code><\/p>\n<p>\u0412 <strong>ZFS<\/strong> \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0442\u0430\u043a\u0430\u044f \u043f\u043e\u043b\u0435\u0437\u043d\u0430\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c, \u043a\u0430\u043a \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0447\u0442\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445, \u043e\u043d\u043e \u0436\u0435 <strong>prefetch<\/strong>. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u0432 <strong>ZFS<\/strong> \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043e \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0447\u0442\u0435\u043d\u0438\u0435 \u043a\u0430\u043a \u043d\u0430 \u0444\u0430\u0439\u043b\u043e\u0432\u043e\u043c, \u0442\u0430\u043a \u0438 \u043d\u0430 \u0431\u043b\u043e\u0447\u043d\u043e\u043c \u0443\u0440\u043e\u0432\u043d\u0435. \u041d\u043e \u044d\u0442\u043e\u0442 \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u0441\u0435\u0431\u044f \u043e\u043f\u0440\u0430\u0432\u0434\u044b\u0432\u0430\u0435\u0442, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043b\u0443\u0447\u0448\u0435 \u0432\u0441\u0435\u0433\u043e \u0435\u0433\u043e \u043e\u0442\u043a\u043b\u044e\u0447\u0430\u0442\u044c (\u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u0442\u0440\u043e\u043a\u0443 \u0432 <strong>\/etc\/system<\/strong> \u0438 \u043f\u0435\u0440\u0435\u0433\u0440\u0443\u0436\u0430\u0435\u043c\u0441\u044f):<\/p>\n<p><code>set zfs:zfs_prefetch_disable = 1<\/code><\/p>\n<p>\u041e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u043c \u0440\u0430\u0437\u043c\u0435\u0440 \u043a\u044d\u0448\u0430 <strong>ZFS<\/strong> \u0432 \u043e\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u0439 \u043f\u0430\u043c\u044f\u0442\u0438 (\u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0441\u0442\u0440\u043e\u043a\u0443 \u0432 <strong>\/etc\/system<\/strong> \u0438 \u043f\u0435\u0440\u0435\u0433\u0440\u0443\u0436\u0430\u0435\u043c\u0441\u044f)<\/p>\n<p><code>set zfs:zfs_arc_max = 32212254720<\/code><\/p>\n<p>\u041e\u0431\u044b\u0447\u043d\u043e <strong>ARC<\/strong> \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u043d\u0438\u043c\u0430\u0442\u044c \u043f\u043e\u0447\u0442\u0438 \u0432\u0441\u044e \u043e\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u0443\u044e \u043f\u0430\u043c\u044f\u0442\u044c (\u043e\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u0430\u044f \u043f\u0430\u043c\u044f\u0442\u044c \u043c\u0438\u043d\u0443\u0441 1\u0413\u0431), \u043d\u043e \u0437\u0430\u0447\u0435\u043c \u0441\u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0430\u043c\u044f\u0442\u0438 \u043e\u0442\u0434\u0430\u0432\u0430\u0442\u044c? \u0414\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043e\u0442\u0434\u0430\u0432\u0430\u0442\u044c \u043d\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 \u043f\u043e\u043b\u043e\u0432\u0438\u043d\u044b (\u0432 \u043d\u0430\u0448\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 64 \u0413\u0431, \u0438 \u043c\u044b \u043e\u0442\u0434\u0430\u0451\u043c \u043d\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 32\u0413\u0431)<\/p>\n<p>\u0420\u0430\u0437\u043d\u0435\u0441\u0435\u043d\u0438\u0435 \u0431\u0430\u0437\u044b \u0438 \u0436\u0443\u0440\u043d\u0430\u043b\u043e\u0432 \u043d\u0430 \u0440\u0430\u0437\u043d\u044b\u0435 \u0434\u0438\u0441\u043a\u0438 \u0442\u043e\u0436\u0435 \u0441\u043f\u043e\u0441\u043e\u0431\u0441\u0442\u0432\u0443\u0435\u0442 \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u044e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438.<\/p>\n<p>\u0414\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043e \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0431\u0430\u0437 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 <strong>zfs<\/strong> \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0447\u0435\u0441\u0442\u044c <a title=\"\u0437\u0434\u0435\u0441\u044c\" rel=\"nofollow\" href=\"http:\/\/www.solarisinternals.com\/wiki\/index.php\/ZFS_for_Databases\" target=\"_blank\">\u0437\u0434\u0435\u0441\u044c<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0411\u0430\u0437\u044b \u0434\u0430\u043d\u043d\u044b\u0445, web \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u0415\u0441\u043b\u0438 \u0432\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 mysql+memcached, \u0442\u043e \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0434\u0432\u043e\u0439\u043d\u043e\u0433\u043e \u043a\u0435\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f: zfs \u0438 memcached &#8211; \u043a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437 \u043d\u0438\u0445 \u043a\u0435\u0448\u0438\u0440\u0443\u0435\u0442. \u0412\u044b\u0445\u043e\u0434 \u043e\u0434\u0438\u043d: \u0440\u0430\u0437\u0440\u0435\u0448\u0438\u0442\u044c \u043a\u0435\u0448\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0435. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u043e\u0431\u043e\u0438\u0445 \u0441\u0432\u043e\u0439\u0441\u0442\u0432 \u2013\u00a0all,\u00a0none\u00a0\u0438\u00a0metadata. \u041f\u0440\u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435 \u043d\u0430\u00a0all\u00a0\u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0438 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0445. \u041f\u0440\u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435 \u043d\u0430\u00a0none\u00a0\u043a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0438 \u043c\u0435\u0442\u0430\u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f. \u041f\u0440\u0438 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435 \u043d\u0430\u00a0metadata\u00a0\u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0442\u043e\u043b\u044c\u043a\u043e [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,5,24],"tags":[],"class_list":["post-2102","post","type-post","status-publish","format-standard","hentry","category-freebsd","category-linux","category-solaris"],"_links":{"self":[{"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=\/wp\/v2\/posts\/2102","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2102"}],"version-history":[{"count":26,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=\/wp\/v2\/posts\/2102\/revisions"}],"predecessor-version":[{"id":4210,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=\/wp\/v2\/posts\/2102\/revisions\/4210"}],"wp:attachment":[{"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2102"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2102"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/skeletor.org.ua\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2102"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}