Sur utilisation mémoire

Bonjour,

J’utilise une debian 6.0.3 / 2.6.32-5-amd64 / x86_64

Sur cette machine ( VM, sur ESX avec 16vCPU, 20G ram), je fais tourné chaque soir des taches planifié ( des exports issu d’une base de données MySQL, qui n’est pas sur le serveur lui même )

Les crons se déroulent bien mais a la fin des traitement je me trouve avec une quantité de mémoire ‘apps’ énorme et surtout j’ai l’impression qu’elle ne se vide pas…

Lorsque je fais un top

je n’ai quasiment aucuns processus en cours. ( mais par contre pas mal de processus ‘sleeping’ )

Mes questions :

Comment libérer de la mémoire ?
Faut il que je réajuste ma configuration de Mémoire/CPU?

Merci

Qu’affichent les commandes suivantes ?

free cat /proc/meminfo cat /proc/slabinfo

Merci pour ton retour! :wink:

Entre temps j’ai relancer apache2, ca a “vidé” un peu de mémoire.

free

                       total       used       free     shared    buffers     cached
Mem:                 20609408   13757756    6851652          0      23288      77164
-/+ buffers/cache:   13657304    6952104
Swap:                 8526840      10896    8515944

cat /proc/meminfo

MemTotal: 20609408 kB MemFree: 6852376 kB Buffers: 23396 kB Cached: 77176 kB SwapCached: 7144 kB Active: 144552 kB Inactive: 65016 kB Active(anon): 101976 kB Inactive(anon): 7140 kB Active(file): 42576 kB Inactive(file): 57876 kB Unevictable: 0 kB Mlocked: 0 kB SwapTotal: 8526840 kB SwapFree: 8515944 kB Dirty: 0 kB Writeback: 0 kB AnonPages: 102656 kB Mapped: 12600 kB Shmem: 88 kB Slab: 57680 kB SReclaimable: 13140 kB SUnreclaim: 44540 kB KernelStack: 1944 kB PageTables: 6092 kB NFS_Unstable: 0 kB Bounce: 0 kB WritebackTmp: 0 kB CommitLimit: 18831544 kB Committed_AS: 204480 kB VmallocTotal: 34359738367 kB VmallocUsed: 337768 kB VmallocChunk: 34342648624 kB HardwareCorrupted: 0 kB HugePages_Total: 0 HugePages_Free: 0 HugePages_Rsvd: 0 HugePages_Surp: 0 Hugepagesize: 2048 kB DirectMap4k: 10240 kB DirectMap2M: 3135488 kB DirectMap1G: 17825792 kB

cat /proc/slabinfo

# name <active_objs> <num_objs> <objsize> <objperslab> <pagesperslab> : tunables <limit> <batchcount> <sharedfactor> : slabdata <active_slabs> <num_slabs> <sharedavail> nf_conntrack_expect 238 238 240 34 2 : tunables 0 0 0 : slabdata 7 7 0 nf_conntrack_ffffffff816805b0 417 442 312 26 2 : tunables 0 0 0 : slabdata 17 17 0 ext3_inode_cache 4558 4840 808 40 8 : tunables 0 0 0 : slabdata 121 121 0 ext3_xattr 0 0 88 46 1 : tunables 0 0 0 : slabdata 0 0 0 journal_handle 2720 2720 24 170 1 : tunables 0 0 0 : slabdata 16 16 0 journal_head 576 576 112 36 1 : tunables 0 0 0 : slabdata 16 16 0 revoke_table 256 256 16 256 1 : tunables 0 0 0 : slabdata 1 1 0 revoke_record 1408 1408 32 128 1 : tunables 0 0 0 : slabdata 11 11 0 kmalloc_dma-512 32 32 512 32 4 : tunables 0 0 0 : slabdata 1 1 0 ip6_dst_cache 50 50 320 25 2 : tunables 0 0 0 : slabdata 2 2 0 UDPLITEv6 0 0 1024 32 8 : tunables 0 0 0 : slabdata 0 0 0 UDPv6 512 512 1024 32 8 : tunables 0 0 0 : slabdata 16 16 0 tw_sock_TCPv6 400 400 320 25 2 : tunables 0 0 0 : slabdata 16 16 0 TCPv6 272 272 1856 17 8 : tunables 0 0 0 : slabdata 16 16 0 cfq_queue 389 408 168 24 1 : tunables 0 0 0 : slabdata 17 17 0 bsg_cmd 0 0 312 26 2 : tunables 0 0 0 : slabdata 0 0 0 mqueue_inode_cache 108 108 896 36 8 : tunables 0 0 0 : slabdata 3 3 0 hugetlbfs_inode_cache 26 26 616 26 4 : tunables 0 0 0 : slabdata 1 1 0 dquot 0 0 256 32 2 : tunables 0 0 0 : slabdata 0 0 0 ksm_mm_slot 0 0 56 73 1 : tunables 0 0 0 : slabdata 0 0 0 posix_timers_cache 92 92 176 46 2 : tunables 0 0 0 : slabdata 2 2 0 UDP-Lite 0 0 832 39 8 : tunables 0 0 0 : slabdata 0 0 0 RAW 756 756 768 42 8 : tunables 0 0 0 : slabdata 18 18 0 UDP 624 624 832 39 8 : tunables 0 0 0 : slabdata 16 16 0 tw_sock_TCP 256 256 256 32 2 : tunables 0 0 0 : slabdata 8 8 0 TCP 304 304 1664 19 8 : tunables 0 0 0 : slabdata 16 16 0 blkdev_queue 70 70 2256 14 8 : tunables 0 0 0 : slabdata 5 5 0 blkdev_requests 396 456 336 24 2 : tunables 0 0 0 : slabdata 19 19 0 fsnotify_event 117 117 104 39 1 : tunables 0 0 0 : slabdata 3 3 0 bip-256 7 7 4224 7 8 : tunables 0 0 0 : slabdata 1 1 0 bip-128 0 0 2176 15 8 : tunables 0 0 0 : slabdata 0 0 0 bip-64 0 0 1152 28 8 : tunables 0 0 0 : slabdata 0 0 0 bip-16 672 672 384 42 4 : tunables 0 0 0 : slabdata 16 16 0 sock_inode_cache 849 874 704 46 8 : tunables 0 0 0 : slabdata 19 19 0 file_lock_cache 704 704 184 44 2 : tunables 0 0 0 : slabdata 16 16 0 net_namespace 45 45 2112 15 8 : tunables 0 0 0 : slabdata 3 3 0 shmem_inode_cache 878 880 808 40 8 : tunables 0 0 0 : slabdata 22 22 0 Acpi-ParseExt 5136 5152 72 56 1 : tunables 0 0 0 : slabdata 92 92 0 task_delay_info 777 864 112 36 1 : tunables 0 0 0 : slabdata 24 24 0 taskstats 24 24 328 24 2 : tunables 0 0 0 : slabdata 1 1 0 proc_inode_cache 2937 3100 648 25 4 : tunables 0 0 0 : slabdata 124 124 0 sigqueue 400 400 160 25 1 : tunables 0 0 0 : slabdata 16 16 0 radix_tree_node 3434 4379 560 29 4 : tunables 0 0 0 : slabdata 151 151 0 bdev_cache 390 390 832 39 8 : tunables 0 0 0 : slabdata 10 10 0 sysfs_dir_cache 12381 12393 80 51 1 : tunables 0 0 0 : slabdata 243 243 0 inode_cache 1115 1215 600 27 4 : tunables 0 0 0 : slabdata 45 45 0 dentry 11181 11214 192 42 2 : tunables 0 0 0 : slabdata 267 267 0 buffer_head 8147 8208 112 36 1 : tunables 0 0 0 : slabdata 228 228 0 vm_area_struct 5360 5676 184 44 2 : tunables 0 0 0 : slabdata 129 129 0 mm_struct 576 576 896 36 8 : tunables 0 0 0 : slabdata 16 16 0 files_cache 736 736 704 46 8 : tunables 0 0 0 : slabdata 16 16 0 sighand_cache 457 495 2112 15 8 : tunables 0 0 0 : slabdata 33 33 0 task_struct 513 558 1808 18 8 : tunables 0 0 0 : slabdata 31 31 0 anon_vma 2517 2816 32 128 1 : tunables 0 0 0 : slabdata 22 22 0 shared_policy_node 1360 1360 48 85 1 : tunables 0 0 0 : slabdata 16 16 0 numa_policy 170 170 24 170 1 : tunables 0 0 0 : slabdata 1 1 0 idr_layer_cache 540 540 544 30 4 : tunables 0 0 0 : slabdata 18 18 0 kmalloc-8192 3376 3380 8192 4 8 : tunables 0 0 0 : slabdata 845 845 0 kmalloc-4096 485 528 4096 8 8 : tunables 0 0 0 : slabdata 66 66 0 kmalloc-2048 416 432 2048 16 8 : tunables 0 0 0 : slabdata 27 27 0 kmalloc-1024 1062 1216 1024 32 8 : tunables 0 0 0 : slabdata 38 38 0 kmalloc-512 954 1088 512 32 4 : tunables 0 0 0 : slabdata 34 34 0 kmalloc-256 827 992 256 32 2 : tunables 0 0 0 : slabdata 31 31 0 kmalloc-128 1216 1312 128 32 1 : tunables 0 0 0 : slabdata 41 41 0 kmalloc-64 3816 4544 64 64 1 : tunables 0 0 0 : slabdata 71 71 0 kmalloc-32 6015 6016 32 128 1 : tunables 0 0 0 : slabdata 47 47 0 kmalloc-16 6399 6400 16 256 1 : tunables 0 0 0 : slabdata 25 25 0 kmalloc-8 10714 10752 8 512 1 : tunables 0 0 0 : slabdata 21 21 0 kmalloc-192 2715 3654 192 42 2 : tunables 0 0 0 : slabdata 87 87 0 kmalloc-96 1109 1344 96 42 1 : tunables 0 0 0 : slabdata 32 32 0 kmem_cache_node 410 512 64 64 1 : tunables 0 0 0 : slabdata 8 8 0

Merci

Au besoin j’ajoute mon Apache2 server Status

[code]Current Time: Friday, 11-Apr-2014 14:43:47 CEST
Restart Time: Friday, 11-Apr-2014 10:38:43 CEST
Parent Server Generation: 0
Server uptime: 4 hours 5 minutes 3 seconds
Total accesses: 367 - Total Traffic: 193 kB
CPU Usage: u45.65 s31.48 cu0 cs0 - .525% CPU load
.025 requests/sec - 13 B/second - 538 B/request
1 requests currently being processed, 7 idle workers
W_…
Scoreboard Key:
"_" Waiting for Connection, “S” Starting up, “R” Reading Request,
“W” Sending Reply, “K” Keepalive (read), “D” DNS Lookup,
“C” Closing connection, “L” Logging, “G” Gracefully finishing,
“I” Idle cleanup of worker, “.” Open slot with no current process

Srv PID Acc M CPU SS Req Conn Child Slot Client VHost Request
0-0 16291 0/50/50 _ 5.01 165 139 0.0 0.00 0.00 ::1 server GET /admin/server/feed/generate HTTP/1.0
1-0 16292 0/44/44 _ 8.94 285 136 0.0 0.00 0.00 ::1 server GET /admin/server/feed/generate HTTP/1.0
2-0 16293 0/51/51 _ 12.16 225 131 0.0 0.01 0.01 ::1 server GET /admin/server/feed/generate HTTP/1.0
3-0 16294 1/45/45 W 10.67 0 0 1.3 0.00 0.00 x.x.x.x server GET /server-status HTTP/1.1
4-0 16295 0/45/45 _ 6.54 119 1 0.0 0.00 0.00 y.y.y.y server GET / HTTP/1.1
5-0 16296 0/45/45 _ 20.09 105 125 0.0 0.17 0.17 ::1 server GET /admin/server/feed/generate HTTP/1.0
6-0 16297 0/43/43 _ 6.80 46 126 0.0 0.00 0.00 ::1 server GET /admin/server/feed/generate HTTP/1.0
7-0 16309 0/44/44 _ 6.92 225 87 0.0 0.00 0.00 ::1 server GET /dm/export/do-cron-job HTTP/1.0
Srv Child Server number - generation
PID OS process ID
Acc Number of accesses this connection / this child / this slot
M Mode of operation
CPU CPU usage, number of seconds
SS Seconds since beginning of most recent request
Req Milliseconds required to process most recent request
Conn Kilobytes transferred this connection
Child Megabytes transferred this child
Slot Total megabytes transferred this slot[/code]

Je pensais que ça pouvait être les caches de dentries et inodes qui sont dans le slab (et ne sont pas gênants, la mémoire qu’ils occupent pouvant être libérée en cas de besoin), mais visiblement ce n’est pas le cas. Ce n’est pas non plus le cache de page (“cache disque”) qui est ici très petit comparé à la taille totale de la mémoire.

Sincèrement je comprend pas non plus.

Pour le cache je l’aurai vu direct sur le monitoring, et je n’aurai pas du swap a gogo.

La quantité de swap occupée ne me paraît pas énorme par rapport à la taille de la RAM. Et même en cas de faible pression sur la mémoire, le noyau peut choisir de swapper des pages inactives afin de libérer de la mémoire pour d’autres usages qu’il juge plus efficaces.

En fait il ne swap pas maintenant, car je suis obliger de le reboot quasiment tous les jours pour qu’il n’atteigne pas le swap.

Mais sans reboot, c’est swap assuré

J’y pense, tu n’aurais pas un tmpfs qui se remplit ? Qu’affiche [mono]df -hT[/mono] ?

EDIT: Non, vérification faite la mémoire occupée par les tmpfs est comptée dans le cache (pagecache), fort logiquement.

Désolé du delais :wink:

Sys. fich. Type Taille Uti. Disp. Uti% Monté sur /dev/sda1 ext3 189G 59G 121G 33% / tmpfs tmpfs 9,9G 0 9,9G 0% /lib/init/rw udev tmpfs 9,9G 100K 9,9G 1% /dev tmpfs tmpfs 9,9G 0 9,9G 0% /dev/shm