Linux view file occupation size command and Spring log problem record

I ran into a problem at work yesterday and found that the server's memory occupancy rate was as high as 98%. I asked a colleague to check it out. Which file actually occupies such a large amount of memory?
A colleague taught me to use the following command to view the memory occupied by the file

df -h查看系统中文件的使用情况
du -sh *查看当前目录下各个文件及目录占用空间大小

After using the du -sh command, it is found that the log logs occupy a lot of memory.
Looking at the log again, I found that it was a query to obtain a large amount of data, and the for loop, using the BeanUtils.copyProperties method to copy the object, this method will record a large number of properties copying process in the log, as follows.

sid:PC123456_00123 client_IP:10-21 09:30:00.012 [THREAD-ID=12345] DEBUG:o.a.c.b.converters.StringConverter -   Using default value '' 

sid:PC123456_00123 client_IP:10-21 09:30:00.012 [THREAD-ID=12345] DEBUG:o.apache.commons.beanutils.BeanUtils = BeanUtils.copyProperties(com.test.User@2d565be,com.test.User@298442)

sid:PC123456_00123 client_IP:10-21 09:30:00.012 [THREAD-ID=12345] DEBUG:o.a.c.b.converters.StringConverter - Converting 'String' value 'hello' to type 'String'

After optimizing the code, for this kind of collection that will have a large amount of data, the code itself has problems. This method should not be used, and it is better not to use this method of attribute replication.

Guess you like

Origin blog.csdn.net/sinat_35803474/article/details/109194155