| 114 | * 範例輸出 |
| 115 | {{{ |
| 116 | ~$ ./postgresqltuner.pl |
| 117 | postgresqltuner.pl version 1.0.0 |
| 118 | Connecting to /var/run/postgresql:5432 database template1 with user postgres... |
| 119 | [OK] User used for report have super rights |
| 120 | ===== OS information ===== |
| 121 | [INFO] OS: \SKernel \r on an \m |
| 122 | [INFO] OS total memory: 11.73 GB |
| 123 | [BAD] Memory overcommitment is allowed on the system. This can lead to OOM Killer killing some PostgreSQL process, which will cause a PostgreSQL server restart (crash recovery) |
| 124 | [INFO] sysctl vm.overcommit_ratio=50 |
| 125 | [BAD] vm.overcommit_memory is too small, you will not be able to use more than 50*RAM+SWAP for applications |
| 126 | [INFO] Running in VMware hypervisor |
| 127 | [INFO] Currently used I/O scheduler(s) : cfq |
| 128 | [BAD] CFQ scheduler is bad on virtual machines (hypervisor and/or storage is already dooing I/O scheduling) |
| 129 | ===== General instance informations ===== |
| 130 | ----- Version ----- |
| 131 | [WARN] You are using version 9.4.11 which is not the latest version |
| 132 | ----- Uptime ----- |
| 133 | [INFO] Service uptime : 10m 42s |
| 134 | [WARN] Uptime is less than 1 day. postgresqltuner.pl result may not be accurate |
| 135 | ----- Databases ----- |
| 136 | [INFO] Database count (except templates): 7 |
| 137 | [INFO] Database list (except templates): postgres ssp_jenkins ssp_dev ssp_stage ads_test ads_dev ads_beta |
| 138 | ----- Extensions ----- |
| 139 | [INFO] Number of activated extensions : 1 |
| 140 | [INFO] Activated extensions : plpgsql |
| 141 | [WARN] Extensions pg_stat_statements is disabled |
| 142 | ----- Users ----- |
| 143 | [OK] No user account will expire in less than 7 days |
| 144 | [WARN] some users account have the username as password : ssp_jenkins,ssp_dev,ssp_stage,cmax_dev,cmax_stage,ads_test,ads_dev,ads_beta |
| 145 | [OK] Password encryption is enabled |
| 146 | ----- Connection information ----- |
| 147 | [INFO] max_connections: 300 |
| 148 | [INFO] current used connections: 48 (16.00%) |
| 149 | [INFO] 3 are reserved for super user (1.00%) |
| 150 | [INFO] Average connection age : 06m 05s |
| 151 | [WARN] Average connection age is less than 10 minutes. Use a connection pooler to limit new connection/seconds |
| 152 | ----- Memory usage ----- |
| 153 | [INFO] configured work_mem: 4.00 MB |
| 154 | [INFO] Using an average ratio of work_mem buffers by connection of 150% (use --wmp to change it) |
| 155 | [INFO] total work_mem (per connection): 6.00 MB |
| 156 | [INFO] shared_buffers: 128.00 MB |
| 157 | [INFO] Track activity reserved size : 311.00 KB |
| 158 | [WARN] maintenance_work_mem is less or equal default value. Increase it to reduce maintenance tasks time |
| 159 | [INFO] Max memory usage : |
| 160 | shared_buffers (128.00 MB) |
| 161 | + max_connections * work_mem * average_work_mem_buffers_per_connection (300 * 4.00 MB * 150 / 100 = 1.76 GB) |
| 162 | + autovacuum_max_workers * maintenance_work_mem (3 * 64.00 MB = 192.00 MB) |
| 163 | + track activity size (311.00 KB) |
| 164 | = 2.07 GB |
| 165 | [INFO] effective_cache_size: 4.00 GB |
| 166 | [INFO] Size of all databases : 24.46 GB |
| 167 | [INFO] PostgreSQL maximum memory usage: 17.65% of system RAM |
| 168 | [WARN] Max possible memory usage for PostgreSQL is less than 60% of system total RAM. On a dedicated host you can increase PostgreSQL buffers to optimize performances. |
| 169 | [INFO] max memory+effective_cache_size is 51.74% of total RAM |
| 170 | [WARN] Increase shared_buffers and/or effective_cache_size to use more memory |
| 171 | ----- Logs ----- |
| 172 | [OK] log_hostname is off : no reverse DNS lookup latency |
| 173 | [WARN] log of long queries is desactivated. It will be more difficult to optimize query performances |
| 174 | [OK] log_statement=none |
| 175 | ----- Two phase commit ----- |
| 176 | [OK] Currently no two phase commit transactions |
| 177 | ----- Autovacuum ----- |
| 178 | [OK] autovacuum is activated. |
| 179 | [INFO] autovacuum_max_workers: 3 |
| 180 | ----- Checkpoint ----- |
| 181 | [WARN] checkpoint_completion_target(0.5) is low |
| 182 | ----- Disk access ----- |
| 183 | [OK] fsync is on |
| 184 | [OK] synchronize_seqscans is on |
| 185 | ----- WAL ----- |
| 186 | ----- Planner ----- |
| 187 | [OK] costs settings are defaults |
| 188 | [OK] all plan features are enabled |
| 189 | ===== Database information for database template1 ===== |
| 190 | ----- Database size ----- |
| 191 | [INFO] Database template1 total size : 7.12 MB |
| 192 | [INFO] Database template1 tables size : 4.50 MB (63.16%) |
| 193 | [INFO] Database template1 indexes size : 2.62 MB (36.84%) |
| 194 | ----- Tablespace location ----- |
| 195 | [OK] No tablespace in PGDATA |
| 196 | ----- Shared buffer hit rate ----- |
| 197 | [INFO] shared_buffer_heap_hit_rate: 98.12% |
| 198 | [INFO] shared_buffer_toast_hit_rate: 0.00% |
| 199 | [INFO] shared_buffer_tidx_hit_rate: 0.00% |
| 200 | [INFO] shared_buffer_idx_hit_rate: 98.77% |
| 201 | [OK] Shared buffer idx hit rate is very good |
| 202 | ----- Indexes ----- |
| 203 | [OK] No invalid indexes |
| 204 | [OK] No unused indexes |
| 205 | ----- Procedures ----- |
| 206 | [OK] No procedures with default costs |
| 207 | |
| 208 | ===== Configuration advices ===== |
| 209 | ----- checkpoint ----- |
| 210 | [MEDIUM] Your checkpoint completion target is too low. Put something nearest from 0.8/0.9 to balance your writes better during the checkpoint interval |
| 211 | ----- extension ----- |
| 212 | [LOW] Enable pg_stat_statements to collect statistics on all queries (not only queries longer than log_min_duration_statement in logs) |
| 213 | ----- sysctl ----- |
| 214 | [URGENT] set vm.overcommit_memory=2 in /etc/sysctl.conf and run sysctl -p to reload it. This will disable memory overcommitment and avoid postgresql killed by OOM killer. |
| 215 | ----- system ----- |
| 216 | [URGENT] Configure your system to use noop or deadline io scheduler when on virtual machines : |
| 217 | echo deadline > /sys/block/sdX/queue/scheduler |
| 218 | update your kernel parameters line with elevator=deadline to keep this parameter at next reboot |
| 219 | ----- version ----- |
| 220 | [LOW] Upgrade to last version |
| 221 | }}} |