You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Eric Torti <er...@gmail.com> on 2015/10/20 17:19:14 UTC

`cat /dev/null > solr-8983-console.log` frees host's memory

Hey guys!

I had a 52GB solr-8983-console.log on my Solr 5.2.1 Amazon Linux
64-bit box and decided to `cat /dev/null > solr-8983-console.log` to
free space.

The weird thing is that when I checked Sematext I noticed the OS had
freed a lot of memory at the same exact instant I did that.

https://dl.dropboxusercontent.com/u/10240770/disk-space.png

https://dl.dropboxusercontent.com/u/10240770/memory-usage.png

I'm really not very familiar with how the OS allocates memory, but it
seemed weird that truncating a file would actually free some of it.

Any pointers on what I'm missing here would be greatly appreciated.

Best,

Eric Torti

Re: `cat /dev/null > solr-8983-console.log` frees host's memory

Posted by Eric Torti <er...@gmail.com>.
Thank you Shawn, Timothy, Emir and Rajani.

Sorry, Shawn, I ended up cropping out the legend but you were right on
your guess.

Indeed, Timothy, this log is completely redundant. Will get rid of it soon.

I'll look into the resources you all pointed out. Thanks!

Best,

Eric Torti

On Wed, Oct 21, 2015 at 8:21 PM, Rajani Maski
<ra...@lucidworks.com> wrote:
> This details in this link[1] might be of help.
>
> [1]https://support.lucidworks.com/hc/en-us/articles/207072137
>
> On Wed, Oct 21, 2015 at 7:42 AM, Emir Arnautovic <
> emir.arnautovic@sematext.com> wrote:
>
>> Hi Eric,
>> As Shawn explained, memory is freed because it was used to cache portion
>> of log file.
>>
>> Since you are already with Sematext, I guess you are aware, but doesn't
>> hurt to remind you that we also have Logsene that you can use to manage
>> your logs: http://sematext.com/logsene/index.html
>>
>> Thanks,
>> Emir
>>
>> --
>> Monitoring * Alerting * Anomaly Detection * Centralized Log Management
>> Solr & Elasticsearch Support * http://sematext.com/
>>
>>
>>
>>
>> On 20.10.2015 17:42, Shawn Heisey wrote:
>>
>>> On 10/20/2015 9:19 AM, Eric Torti wrote:
>>>
>>>> I had a 52GB solr-8983-console.log on my Solr 5.2.1 Amazon Linux
>>>> 64-bit box and decided to `cat /dev/null > solr-8983-console.log` to
>>>> free space.
>>>>
>>>> The weird thing is that when I checked Sematext I noticed the OS had
>>>> freed a lot of memory at the same exact instant I did that.
>>>>
>>> On that memory graph, the legend doesn't indicate which of the graph
>>> colors represent each of the four usage types at the top -- they all
>>> have blue checkboxes, so I can't tell for sure what changed.
>>>
>>> If the number that dropped is "cached" (which I think is likely) then
>>> everything is working exactly as it should.  The OS had simply cached a
>>> large chunk of the logfile, exactly as it is designed to do, and once
>>> the file was deleted, it stopped reserving that memory and made it
>>> available.
>>>
>>> https://en.wikipedia.org/wiki/Page_cache
>>>
>>> Thanks,
>>> Shawn
>>>
>>>

Re: `cat /dev/null > solr-8983-console.log` frees host's memory

Posted by Rajani Maski <ra...@lucidworks.com>.
This details in this link[1] might be of help.

[1]https://support.lucidworks.com/hc/en-us/articles/207072137

On Wed, Oct 21, 2015 at 7:42 AM, Emir Arnautovic <
emir.arnautovic@sematext.com> wrote:

> Hi Eric,
> As Shawn explained, memory is freed because it was used to cache portion
> of log file.
>
> Since you are already with Sematext, I guess you are aware, but doesn't
> hurt to remind you that we also have Logsene that you can use to manage
> your logs: http://sematext.com/logsene/index.html
>
> Thanks,
> Emir
>
> --
> Monitoring * Alerting * Anomaly Detection * Centralized Log Management
> Solr & Elasticsearch Support * http://sematext.com/
>
>
>
>
> On 20.10.2015 17:42, Shawn Heisey wrote:
>
>> On 10/20/2015 9:19 AM, Eric Torti wrote:
>>
>>> I had a 52GB solr-8983-console.log on my Solr 5.2.1 Amazon Linux
>>> 64-bit box and decided to `cat /dev/null > solr-8983-console.log` to
>>> free space.
>>>
>>> The weird thing is that when I checked Sematext I noticed the OS had
>>> freed a lot of memory at the same exact instant I did that.
>>>
>> On that memory graph, the legend doesn't indicate which of the graph
>> colors represent each of the four usage types at the top -- they all
>> have blue checkboxes, so I can't tell for sure what changed.
>>
>> If the number that dropped is "cached" (which I think is likely) then
>> everything is working exactly as it should.  The OS had simply cached a
>> large chunk of the logfile, exactly as it is designed to do, and once
>> the file was deleted, it stopped reserving that memory and made it
>> available.
>>
>> https://en.wikipedia.org/wiki/Page_cache
>>
>> Thanks,
>> Shawn
>>
>>

Re: `cat /dev/null > solr-8983-console.log` frees host's memory

Posted by Emir Arnautovic <em...@sematext.com>.
Hi Eric,
As Shawn explained, memory is freed because it was used to cache portion 
of log file.

Since you are already with Sematext, I guess you are aware, but doesn't 
hurt to remind you that we also have Logsene that you can use to manage 
your logs: http://sematext.com/logsene/index.html

Thanks,
Emir

-- 
Monitoring * Alerting * Anomaly Detection * Centralized Log Management
Solr & Elasticsearch Support * http://sematext.com/



On 20.10.2015 17:42, Shawn Heisey wrote:
> On 10/20/2015 9:19 AM, Eric Torti wrote:
>> I had a 52GB solr-8983-console.log on my Solr 5.2.1 Amazon Linux
>> 64-bit box and decided to `cat /dev/null > solr-8983-console.log` to
>> free space.
>>
>> The weird thing is that when I checked Sematext I noticed the OS had
>> freed a lot of memory at the same exact instant I did that.
> On that memory graph, the legend doesn't indicate which of the graph
> colors represent each of the four usage types at the top -- they all
> have blue checkboxes, so I can't tell for sure what changed.
>
> If the number that dropped is "cached" (which I think is likely) then
> everything is working exactly as it should.  The OS had simply cached a
> large chunk of the logfile, exactly as it is designed to do, and once
> the file was deleted, it stopped reserving that memory and made it
> available.
>
> https://en.wikipedia.org/wiki/Page_cache
>
> Thanks,
> Shawn
>

Re: `cat /dev/null > solr-8983-console.log` frees host's memory

Posted by Shawn Heisey <ap...@elyograg.org>.
On 10/22/2015 12:24 AM, Shalin Shekhar Mangar wrote:
> Should we remove the console appender by default? This is very trappy I guess.

The only time we should need console logging is when Solr is run in the
foreground, and in that case, it should not be saved to a file, just
printed on the console.  The log4j console output contains the same
information as the rotated logfile, so even when Solr is run in the
background, I think it's completely unnecessary to save it.

We do need to save console output in the startup script when running in
the background, because startup problems and some kinds of developer
debug output are likely to be reported there.

The start script should be able to use a different log4j config file
that logs to the console when running in the foreground.  Looking at the
bash script, that will probably require a little bit of rework on the
script flow, but shouldn't be particularly difficult.  I have not looked
at the Windows script.

When I wrote my own init scripts a few years back, I was using log4j
before the official switch in 4.3.0, and I was only sending log4j output
to a file, not the console.

My init script sent stdout and stderr to different files -- "logs/out"
and "logs/err".  I like this arrangement, but I wonder if that's too
much complexity for the general case.

I opened SOLR-8186 for the enhancement idea.

Thanks,
Shawn


Re: `cat /dev/null > solr-8983-console.log` frees host's memory

Posted by Shalin Shekhar Mangar <sh...@gmail.com>.
Hi Tim,

Should we remove the console appender by default? This is very trappy I guess.

On Tue, Oct 20, 2015 at 11:39 PM, Timothy Potter <th...@gmail.com> wrote:
> You should fix your log4j.properties file to no log to console ...
> it's there for the initial getting started experience, but you don't
> need to send log messages to 2 places.
>
> On Tue, Oct 20, 2015 at 10:42 AM, Shawn Heisey <ap...@elyograg.org> wrote:
>> On 10/20/2015 9:19 AM, Eric Torti wrote:
>>> I had a 52GB solr-8983-console.log on my Solr 5.2.1 Amazon Linux
>>> 64-bit box and decided to `cat /dev/null > solr-8983-console.log` to
>>> free space.
>>>
>>> The weird thing is that when I checked Sematext I noticed the OS had
>>> freed a lot of memory at the same exact instant I did that.
>>
>> On that memory graph, the legend doesn't indicate which of the graph
>> colors represent each of the four usage types at the top -- they all
>> have blue checkboxes, so I can't tell for sure what changed.
>>
>> If the number that dropped is "cached" (which I think is likely) then
>> everything is working exactly as it should.  The OS had simply cached a
>> large chunk of the logfile, exactly as it is designed to do, and once
>> the file was deleted, it stopped reserving that memory and made it
>> available.
>>
>> https://en.wikipedia.org/wiki/Page_cache
>>
>> Thanks,
>> Shawn
>>



-- 
Regards,
Shalin Shekhar Mangar.

Re: `cat /dev/null > solr-8983-console.log` frees host's memory

Posted by Timothy Potter <th...@gmail.com>.
You should fix your log4j.properties file to no log to console ...
it's there for the initial getting started experience, but you don't
need to send log messages to 2 places.

On Tue, Oct 20, 2015 at 10:42 AM, Shawn Heisey <ap...@elyograg.org> wrote:
> On 10/20/2015 9:19 AM, Eric Torti wrote:
>> I had a 52GB solr-8983-console.log on my Solr 5.2.1 Amazon Linux
>> 64-bit box and decided to `cat /dev/null > solr-8983-console.log` to
>> free space.
>>
>> The weird thing is that when I checked Sematext I noticed the OS had
>> freed a lot of memory at the same exact instant I did that.
>
> On that memory graph, the legend doesn't indicate which of the graph
> colors represent each of the four usage types at the top -- they all
> have blue checkboxes, so I can't tell for sure what changed.
>
> If the number that dropped is "cached" (which I think is likely) then
> everything is working exactly as it should.  The OS had simply cached a
> large chunk of the logfile, exactly as it is designed to do, and once
> the file was deleted, it stopped reserving that memory and made it
> available.
>
> https://en.wikipedia.org/wiki/Page_cache
>
> Thanks,
> Shawn
>

Re: `cat /dev/null > solr-8983-console.log` frees host's memory

Posted by Shawn Heisey <ap...@elyograg.org>.
On 10/20/2015 9:19 AM, Eric Torti wrote:
> I had a 52GB solr-8983-console.log on my Solr 5.2.1 Amazon Linux
> 64-bit box and decided to `cat /dev/null > solr-8983-console.log` to
> free space.
>
> The weird thing is that when I checked Sematext I noticed the OS had
> freed a lot of memory at the same exact instant I did that.

On that memory graph, the legend doesn't indicate which of the graph
colors represent each of the four usage types at the top -- they all
have blue checkboxes, so I can't tell for sure what changed.

If the number that dropped is "cached" (which I think is likely) then
everything is working exactly as it should.  The OS had simply cached a
large chunk of the logfile, exactly as it is designed to do, and once
the file was deleted, it stopped reserving that memory and made it
available.

https://en.wikipedia.org/wiki/Page_cache

Thanks,
Shawn