LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Freeing up Memory (https://www.linuxquestions.org/questions/linux-general-1/freeing-up-memory-98481/)

DigiCrime 09-29-2003 11:37 PM

Freeing up Memory
 
Is it possible to free up memory without having to reboot it??

Currently I have a server that is using up 96% of its memory,

Physical Memory 96% 38.54 MB 967.98 MB 1006.52 MB
Disk Swap 7% 1.81 GB 145.49 MB 1.95 GB

During the night though not a lot is running on it, just a few things, couple users no big deal. Its a Xeon server.

Processors 4
Model Intel(R) Xeon(TM) CPU 2.00GHz
Chip MHz 1993.41
Cache Size 512 KB
System Bogomips 15925.22
PCI Devices Intel Corp. 82540EM Gigabit Ethernet Controller
ATI Technologies Inc Rage XL
ServerWorks CSB5 IDE Controller
LSI Logic / Symbios Logic (formerly NCR) 53c1030

IDE Devices hdc: SAMSUNG CD-ROM SC-148C

SCSI Devices FUJITSU MAP3735NP ( Direct-Access )
FUJITSU MAP3735NP ( Direct-Access )


I had someone look at it the other day saying that mysql and named was taking up most of the memory.

Top -at the moment

11:34pm up 38 days, 15:36, 2 users, load average: 0.21, 0.16, 0.16
124 processes: 123 sleeping, 1 running, 0 zombie, 0 stopped
CPU0 states: 0.0% user, 0.0% system, 0.0% nice, 100.0% idle
CPU1 states: 1.0% user, 0.1% system, 0.0% nice, 98.0% idle
CPU2 states: 4.1% user, 3.1% system, 0.0% nice, 91.1% idle
CPU3 states: 0.0% user, 0.0% system, 0.0% nice, 100.0% idle
Mem: 1030676K av, 1010960K used, 19716K free, 0K shrd, 102272K buff
Swap: 2048276K av, 148976K used, 1899300K free 594536K cached


Sorted by memory
19219 mysql 9 0 55972 53M 1372 S 0.0 5.2 0:54 mysqld
19221 mysql 9 0 55972 53M 1372 S 0.0 5.2 0:04 mysqld
19222 mysql 9 0 55972 53M 1372 S 0.0 5.2 0:22 mysqld
19224 mysql 9 0 55972 53M 1372 S 0.0 5.2 36:57 mysqld
19244 mysql 9 0 55972 53M 1372 S 0.0 5.2 38:59 mysqld
19358 mysql 9 0 55972 53M 1372 S 0.0 5.2 35:26 mysqld
19472 mysql 9 0 55972 53M 1372 S 0.0 5.2 36:12 mysqld
19753 mysql 9 0 55972 53M 1372 S 0.0 5.2 35:39 mysqld
19840 mysql 10 0 55972 53M 1372 S 18.0 5.2 36:04 mysqld
21313 mysql 9 0 55972 53M 1372 S 0.2 5.2 36:59 mysqld
22681 mysql 9 0 55972 53M 1372 S 0.0 5.2 35:58 mysqld
23487 mysql 9 0 55972 53M 1372 S 0.0 5.2 36:46 mysqld
31030 mysql 9 0 55972 53M 1372 S 0.0 5.2 33:17 mysqld
31031 mysql 9 0 55972 53M 1372 S 0.0 5.2 33:39 mysqld
344 mysql 9 0 55972 53M 1372 S 0.0 5.2 32:45 mysqld
346 mysql 9 0 55972 53M 1372 S 0.0 5.2 34:13 mysqld
353 mysql 14 0 55972 53M 1372 S 4.8 5.2 34:16 mysqld
1410 mysql 9 0 55972 53M 1372 S 0.0 5.2 32:24 mysqld
1411 mysql 9 0 55972 53M 1372 S 0.0 5.2 33:04 mysqld
14217 mysql 9 0 55972 53M 1372 S 4.1 5.2 24:34 mysqld
14218 mysql 9 0 55972 53M 1372 S 0.0 5.2 24:39 mysqld
1302 named 9 0 36424 35M 1544 S 0.0 3.5 0:00 named
1304 named 9 0 36424 35M 1544 S 0.0 3.5 0:04 named
1305 named 9 0 36424 35M 1544 S 0.0 3.5 6:08 named
1306 named 9 0 36424 35M 1544 S 0.0 3.5 6:10 named
1307 named 9 0 36424 35M 1544 S 0.0 3.5 6:11 named
1308 named 9 0 36424 35M 1544 S 0.0 3.5 6:10 named
1309 named 9 0 36424 35M 1544 S 0.0 3.5 0:08 named
1310 named 9 0 36424 35M 1544 S 0.0 3.5 4:57 named
14950 nobody 9 0 19788 18M 4852 S 0.0 1.8 0:02 httpd
14979 nobody 9 0 19224 18M 4784 S 0.2 1.8 0:01 httpd
14959 nobody 9 0 19164 18M 4720 S 1.3 1.7 0:01 httpd
14958 nobody 14 0 18840 17M 4772 S 2.4 1.7 0:01 httpd
14952 nobody 9 0 17900 16M 4728 S 0.6 1.6 0:01 httpd
14948 nobody 9 0 17052 16M 4700 S 0.0 1.5 0:00 httpd
14949 nobody 9 0 16988 15M 4800 S 0.2 1.5 0:00 httpd


as you can tell mysql is taking up most of the memory and named.

my.conf
[mysqld]
max_connections = 500
key_buffer_size = 16M
myisam_sort_buffer_size = 32M
join_buffer_size = 2M
read_buffer_size = 2M
sort_buffer_size = 3M
table_cache = 1500
thread_cache_size = 128
wait_timeout = 14400
connect_timeout = 10
max_allowed_packet = 2M
max_connect_errors = 10
query_cache_limit = 1M
query_cache_size = 16M
query_cache_type = 1
skip-innodb

[mysqld_safe]
open_files_limit = 8192

[mysqldump]
quick
max_allowed_packet = 2M

[myisamchk]
key_buffer = 150M
sort_buffer = 1M
read_buffer = 1M
write_buffer = 16M

Would like to optimize this machine, not to sure adding another gig of ram is really gonna help it much :scratch: suggestions/ideas?

-Ron

DavidPhillips 09-30-2003 12:10 AM

It looks pretty much normal. Servers use a lot of memory. The memory may actually available for applications when needed. There is normally a lot of cached and buffered memory.

try looking at

Code:

cat /proc/meminfo
more ram should get you out of the virtual memory for a while.

DigiCrime 09-30-2003 12:12 AM

root@midwest []# cat /proc/meminfo
total: used: free: shared: buffers: cached:
Mem: 1055412224 910721024 144691200 0 116559872 595152896
Swap: 2097434624 153747456 1943687168
MemTotal: 1030676 kB
MemFree: 141300 kB
MemShared: 0 kB
Buffers: 113828 kB
Cached: 482976 kB
SwapCached: 98228 kB
Active: 566368 kB
ActiveAnon: 184752 kB
ActiveCache: 381616 kB
Inact_dirty: 90456 kB
Inact_laundry: 73956 kB
Inact_clean: 50152 kB
Inact_target: 156184 kB
HighTotal: 131008 kB
HighFree: 1024 kB
LowTotal: 899668 kB
LowFree: 140276 kB
SwapTotal: 2048276 kB
SwapFree: 1898132 kB
root@midwest []#

wapcaplet 09-30-2003 02:33 AM

Unless you are actually encountering problems with not having enough memory to run programs, there's probably nothing to worry about. Why have all that RAM and not use it? It's using power whether it's being used by programs or not.

DigiCrime 09-30-2003 06:40 AM

not really any problems, just slow loading sites that use mysql :)

yapp 09-30-2003 07:25 AM

If your site is really slow, you might want to look at the amount of queries you send to your MySQL server, and how much data they require. For example, a "SELECT *" in generally a bad idea. joining tables and such is even worse.

There is one other thing: you basically don't want your machine to swap! Writing to the HD is an expensive process, for both HD and CPU.. certainly if you're trying to alter a large database at the same time. And the Linux 2.4.x kernel isn't able to handle read requests while it's writing to the disk.


All times are GMT -5. The time now is 11:58 PM.