|
|
#1 (permalink) |
|
Bow before Surpass!
Super #1
Joined in Sep 2004
1,542 posts
Gave thanks: 91
Thanked 49 times
|
PHP Memory Checker
I'm trying to do a "if" statement where the PHP checks on the server's memory usage and performs actions based on the amount.
For example, if it could find the usage of memory in percentage values, then I'd have an if statement tha would... PHP Code:
Thank you ![]()
__________________
Wii Hotspot - Upcoming project! -http://www.wiihotspot.com
Make a cPanel Login Form | Why is my Account Suspended? |
|
|
|
|
|
#2 (permalink) |
|
Surpass Fan
Excelling Contributor
Joined in Nov 2005
Lives in Colorado
Hosted on DEDI
934 posts
Gave thanks: 2
Thanked 94 times
|
Memory is physical and swap, so you need to determine the criteria you wish to compare when you indicate values like low, medium, high. I graph my server memory and keep my eye on a constant System, currently around 40%, and a very low swap file.
If I were to use an if() statement to determine tasks I suppose I would use the swap file as the deciding factor: low < 5%; high > 70%. ![]() You will find memory usage in the file meminfo in the proc directory. Sample: Code:
MemTotal: 451100 kB MemFree: 21956 kB Buffers: 76644 kB Cached: 170976 kB SwapCached: 19332 kB Active: 244424 kB Inactive: 127024 kB HighTotal: 0 kB HighFree: 0 kB LowTotal: 451100 kB LowFree: 21956 kB SwapTotal: 2048276 kB SwapFree: 1962216 kB Dirty: 1216 kB Writeback: 0 kB Mapped: 139048 kB Slab: 50756 kB Committed_AS: 443792 kB PageTables: 2240 kB VmallocTotal: 565240 kB VmallocUsed: 3644 kB VmallocChunk: 561348 kB HugePages_Total: 0 HugePages_Free: 0 Hugepagesize: 4096 kB Sample: Code:
Filename Type Size Used Priority /dev/hda3 partition 2048276 86060 -1 Filename Type Size Used Priority /dev/hda3 partition 2048276 86060 -1 Filename Type Size Used Priority /dev/hda3 partition 2048276 86060 -1 Filename Type Size Used Priority /dev/hda3 partition 2048276 86060 -1 Filename Type Size Used Priority /dev/hda3 partition 2048276 86060 -1 PHP Code:
__________________
Where would you be if you were at the highest court in the land (US)? |
|
|
|
|
|
#3 (permalink) |
|
Bow before Surpass!
Super #1
Joined in Sep 2004
1,542 posts
Gave thanks: 91
Thanked 49 times
|
You're my hero Cowboy! Thanks for this! I'll try it soon and see how it goes, also thanks for the information on about memory.
I'd click "thanks" if there the feature was still there... :P
__________________
Wii Hotspot - Upcoming project! -http://www.wiihotspot.com
Make a cPanel Login Form | Why is my Account Suspended? |
|
|
|