Arkiv

Inlägg taggade ‘vps’

Starta om linux på natten

oktober 25th, 2011 Inga kommentarer

Jag har lite diffusa problem med minnesanvändningen av min VPS just nu, och en temporär(!) lösning kan vara att starta om servern en gång mitt i natten, det har löst det tillfälligt för mig, medans jag optimerar apache & mysql så får det vara så här.

Logga in som root och kör ‘crontab -e’ och lägg sedan in detta för att starta om en gång varje natt klockan 04:00, all output som kan tänkas komma från den kastas bort.

0 4 * * * shutdown -r now >/dev/null

Åter igen så vill jag poängtera att detta endast är en temporär lösning!

Categories: GSOC Taggar: , , , , ,

Optimera MySQL

oktober 22nd, 2011 Inga kommentarer

Tänkte tipsa om ännu ett verktyg för att optimera mysql och hålla ordning på allt, och det är tuning-primer.sh

Du kan ladda hem scriptet här:

http://www.day32.com/MySQL/tuning-primer.sh

Här nedan kan du se ett exempel på resultatet från tuning-primer.sh:

— MYSQL PERFORMANCE TUNING PRIMER –
– By: Matthew Montgomery -

MySQL Version 5.0.51a-24+lenny2-log i486

Uptime = 0 days 0 hrs 0 min 14 sec
Avg. qps = 73
Total Questions = 1028
Threads Connected = 2

Warning: Server has not been running for at least 48hrs.
It may not be safe to use these recommendations

To find out more information on how each of these
runtime variables effects performance visit:

http://dev.mysql.com/doc/refman/5.0/en/server-system-variables.html

Visit http://www.mysql.com/products/enterprise/advisors.html
for info about MySQL’s Enterprise Monitoring and Advisory Service

SLOW QUERIES
The slow query log is enabled.
Current long_query_time = 2 sec.
You have 0 out of 1124 that take longer than 2 sec. to complete
Your long_query_time seems to be fine

BINARY UPDATE LOG
The binary update log is NOT enabled.
You will not be able to do point in time recovery
See http://dev.mysql.com/doc/refman/5.0/en/point-in-time-recovery.html

WORKER THREADS
Current thread_cache_size = 8
Current threads_cached = 1
Current threads_per_sec = 0
Historic threads_per_sec = 0
Your thread_cache_size is fine

MAX CONNECTIONS
Current max_connections = 125
Current threads_connected = 1
Historic max_used_connections = 2
The number of used connections is 1% of the configured maximum.
You are using less than 10% of your configured max_connections.
Lowering max_connections could help to avoid an over-allocation of memory
See ”MEMORY USAGE” section to make sure you are not over-allocating

No InnoDB Support Enabled!

MEMORY USAGE
Max Memory Ever Allocated : 71 M
Configured Max Per-thread Buffers : 328 M
Configured Max Global Buffers : 66 M
Configured Max Memory Limit : 394 M
Physical Memory : 1011 M
Max memory limit seem to be within acceptable norms

KEY BUFFER
Current MyISAM index space = 14 M
Current key_buffer_size = 16 M
Key cache miss rate is 1 : 13
Key buffer free ratio = 87 %
Your key_buffer_size seems to be fine

QUERY CACHE
Query cache is enabled
Current query_cache_size = 40 M
Current query_cache_used = 388 K
Current query_cache_limit = 1 M
Current Query cache Memory fill ratio = .94 %
Current query_cache_min_res_unit = 4 K
Your query_cache_size seems to be too high.
Perhaps you can use these resources elsewhere
MySQL won’t cache query results that are larger than query_cache_limit in size

SORT OPERATIONS
Current sort_buffer_size = 2 M
Current read_rnd_buffer_size = 256 K
Sort buffer seems to be fine

JOINS
Current join_buffer_size = 132.00 K
You have had 0 queries where a join could not use an index properly
Your joins seem to be using indexes properly

OPEN FILES LIMIT
Current open_files_limit = 4247 files
The open_files_limit should typically be set to at least 2x-3x
that of table_cache if you have heavy MyISAM usage.
Your open_files_limit value seems to be fine

TABLE CACHE
Current table_cache value = 2056 tables
You have a total of 673 tables
You have 673 open tables.
The table_cache value seems to be fine

TEMP TABLES
Current max_heap_table_size = 16 M
Current tmp_table_size = 32 M
Of 208 temp tables, 16% were created on disk
Effective in-memory tmp_table_size is limited to max_heap_table_size.
Created disk tmp tables ratio seems fine

TABLE SCANS
Current read_buffer_size = 128 K
Current table scan ratio = 7 : 1
read_buffer_size seems to be fine

TABLE LOCKING
Current Lock Wait ratio = 0 : 2056
Your table locking seems to be fine

Categories: GSOC Taggar: , , , , , , ,

Starta om linux vid kernel panic

oktober 20th, 2011 Inga kommentarer

För att starta om din linux burk vid kernel panics så skriv in följande i botten på din /etc/sysctl.conf fil:

kernel.panic = 20

Då kommer den starta om efter 20 sekunder då den fått en kernel panic.

Notera dock att det kan vara bra att använda swatch eller något för att läsa loggar om man gör så här, men har man inte tillgång till servern 24/7 så kan det vara behändigt att den startar om själv.

Categories: GSOC Taggar: , , ,