ok first ssh onto the server console and type slabtop to look to see how much memory dentry is using.
Active / Total Objects (% used) : 21729664 / 22216467 (97.8%)
Active / Total Slabs (% used) : 1123731 / 1123757 (100.0%)
Active / Total Caches (% used) : 102 / 185 (55.1%)
Active / Total Size (% used) : 4164789.59K / 4233279.36K (98.4%)
Minimum / Average / Maximum Object : 0.02K / 0.19K / 4096.00K
OBJS ACTIVE USE OBJ SIZE SLABS OBJ/SLAB CACHE SIZE NAME
19754140 19754049 99% 0.19K 987707 20 3950828K dentry
1900764 1472678 77% 0.10K 51372 37 205488K buffer_head
254788 254745 99% 0.98K 63697 4 254788K ext4_inode_cache
89621 88583 98% 0.06K 1519 59 6076K size-64
81753 41708 51% 0.55K 11679 7 46716K radix_tree_node
21056 20715 98% 0.03K 188 112 752K size-32
14256 14236 99% 0.14K 528 27 2112K sysfs_dir_cache
13053 10906 83% 0.20K 687 19 2748K vm_area_struct
12782 9658 75% 0.05K 166 77 664K anon_vma_chain
11720 11601 98% 0.19K 586 20 2344K size-192
8321 8052 96% 0.07K 157 53 628K selinux_inode_security
7370 5386 73% 0.05K 110 67 440K anon_vma
5760 4352 75% 0.12K 192 30 768K size-128
5325 3901 73% 0.25K 355 15 1420K filp
whoah! dentry, go home you're drunk!
To clear that do:
# service nginx stop
Stopping nginx: [ OK ]
# service mysqld stop
Stopping mysqld: [ OK ]
# sync && echo 2 > /proc/sys/vm/drop_caches
# service mysqld start
Starting mysqld: [ OK ]
# service nginx start
Starting nginx: [ OK ]
You don't want to run this with mysql active as it can corrupt databases but this command basically drops dentry cache. I shut down my web server too. If you use a different web server you should probably stop that too. Basically kill all the disk writes you can while this is running. I have 48GB of RAM and I'll run this around 35GB used and it takes a couple min. Ya might also want to adjust the swapiness of your system cause ideally servers shouldn't swap.