github.com/piotrnar/gocoin@v0.0.0-20240512203912-faa0448c5e96/website/gocoin_tweaks.html (about) 1 <html> 2 <head> 3 <link rel="stylesheet" href="style.css" type="text/css"> 4 </head> 5 <body> 6 <h1>Tweaks</h1> 7 On this page you can find ways to improve performance and lower resource consumptions 8 of a running <b>client</b>.<br> 9 <br> 10 11 <h2>Disable counters</h2> 12 Edit the <a href="gocoin_manual_config.html">config file</a> and set the value of <code>Stats.NoCounters</code> to <b>true</b>.<br> 13 This will turn off node's internal statistics which should improve performance.<br> 14 <br> 15 16 <h2>Turn off caching on disk</h2> 17 Edit the <a href="gocoin_manual_config.html">config file</a> and set the value of <code>Memory.CacheOnDisk</code> to <b>false</b>.<br> 18 This will prevent the node from caching blocks on disk, 19 which may improve initial chain sync performance (at a cost of using more RAM).<br> 20 <br> 21 22 <h2>Disable wallet functionality</h2> 23 24 You can disable node's wallet functionality, to save system memory used by a running client 25 and improve block processing times.<br> 26 In order to do so, use TextUI command <code>wallet off</code> or click the disable wallet button on the bottom of the <b>Wallet</b> page in the WebUI.<br> 27 <br> 28 If you don't want the wallet functionality to automatically enable after the node is started, 29 set the value of <code>AllBalances.AutoLoad</code> to <code>false</code> in the 30 <a href="gocoin_manual_config.html">config file</a>.<br> 31 <br> 32 <i>Note: You can manually enable wallet functionality at any time while the node is running, 33 either from WebUI or by executing TextUI command <code>wallet on</code></i><br> 34 <br> 35 <a name="libsecp256k1"></a> 36 <h2>External secp256k1 speedups</h2> 37 38 It is possible to use <a target="_blank" href="https://github.com/bitcoin/bitcoin/tree/master/src/secp256k1">libsecp256k1</a> 39 (maintained by <a target="_blank" href="https://github.com/bitcoin/bitcoin/">Bitcoin Core</a> project) 40 that is written in C and assembler.<br> 41 <br> 42 43 <i><b>Note:</b> 44 Thanks to the recent improvements, an external library does not always perform better than the Gocoin's native one.<br> 45 To check if it does, use test programs from <code>gocoin/lib/others/cgo/ec_bench/</code> - for instance: <code>go run gonative.go</code> vs <code>go run sipasec.go</code></i><br> 46 <br> 47 48 To make Gocoin client to use the external library, copy either the file 49 <code>sipadll.go</code> (Windows only) or <code>sipasec.go</code> (any OS), 50 from <code>gocoin/client/speedups/</code> to its parent folder (<code>gocoin/client/</code>). 51 Then rebuild and restart the client.<br> 52 <i>Note: You can have either <code>sipadll.go</code> or <code>sipasec.go</code> in your 53 <code>gocoin/client/</code> folder, but never both of them as the client will not build then.</i><br> 54 <br> 55 Depending which speedup file you chose, follow either of the instructions in the table below.<br> 56 <br> 57 <table border="1" cellpadding="5" cellspacing="0"> 58 <tr> 59 <td align="center" width="65%"><b>sipasec.go</b></td> 60 <td align="center" width="35%"><b>sipadll.go</b> (Windows only)</td> 61 </tr> 62 <tr> 63 64 <td valign="top"> 65 In order to use <code>sipasec.go</code> speedup, build and install <b>secp256k1</b> library in your system.<br> 66 <br> 67 On Debian based Linux system, simply execute the following commands:<br> 68 69 <code> sudo apt-get install gcc automake autoconf libtool make git libgmp-dev</code> <br> 70 <code> git clone https://github.com/bitcoin/bitcoin.git</code> <br> 71 <code> cd bitcoin/src/secp256k1/</code> <br> 72 <code> ./autogen.sh</code> <br> 73 <code> ./configure</code> <br> 74 <code> make</code> <br> 75 <code> sudo make install</code> <br> 76 <br> 77 <i>Note: When the library is properly installed, executing <code>go test</code> inside 78 <code>gocoin/lib/others/cgo/sipasec/</code> says <b>PASS</b></i> 79 </td> 80 81 <td valign="top"> 82 To use <code>sipadll.go</code> speedup, you have to place <b>secp256k1.dll</b> 83 in <code>gocoin/client/</code> or in any folder where Windows looks for executables 84 (e.g. <code>C:\WINDOWS</code>).<br> 85 <br> 86 You can find <b>secp256k1.dll</b> in <code>gocoin/tools/sipa_dll/</code> 87 or you can download it from <a target="_blank" href="https://sourceforge.net/projects/gocoin/files/?source=directory">sourceforge.net</a> 88 (it's inside <a target="_blank" href="https://sourceforge.net/projects/gocoin/files/secp256k1.dll_v2-amd64.zip/download">secp256k1.dll_v2-amd64.zip</a>).<br> 89 <br> 90 To build <b>secp256k1.dll</b> youself, look into 91 <a target="_blank" href="https://sourceforge.net/projects/gocoin/files/secp256k1_win_v2.zip/download">secp256k1_win_v2.zip</a>. 92 </td> 93 94 </tr> 95 </table> 96 <br> 97 98 <h2>Compress UTXO records</h2> 99 To save some system memory as well as a disk space, although at the cost of a performance, you can compress UTXO database.<br> 100 <br> 101 In order to do this, execute the tool <code>utxo_compress</code>.<br> 102 The tool needs to be executed from inside the data folder - where the <code>UTXO.db</code> file is.<br> 103 The node must not be running while executing the tool.<br> 104 <br> 105 You can reverse the operation of compressing the database, be running <code>utxo_decompress</code>.<br> 106 <br> 107 108 <h2>Garbage Collector and UTXO heap</h2> 109 If you have RAM to spare, try switching UTXO records to Go's heap manager 110 and increasing Garbage Collector's treshold.<br> 111 This will increase memory usage, but should improve block processing performance 112 (e.g. during initial blockchain download).<br> 113 <br> 114 Edit the <a href="gocoin_manual_config.html">config file</a> to set 115 <code>Memory.UseGoHeap</code> to <b>true</b> and 116 <code>Memory.GCPercTrshold</code> to <b>100</b> or more (higher value for more effect).<br> 117 You may also try only increasing <code>Memory.GCPercTrshold</code>, leaving <code>Memory.UseGoHeap</code> set to <b>false</b>.<br> 118 <br> 119 <i>Note: The node needs to be restarted to apply a new value of <code>Memory.UseGoHeap</code></i> 120 </body> 121 </html>