in Education by
I am using mongo for storing log files. Both mongoDB and mysql are running on the same machine, virtualizing mongo env is not an option. I am afraid I will soon run into perf issues as the logs table grows very fast. Is there a way to limit resident memory for mongo so that it won't eat all available memory and excessively slow down the mysql server? DB machine: Debian 'lenny' 5 Other solutions (please comment): As we need all historical data, we can not use capped collections, but I am also considering using a cron script that dumps and deletes old data Should I also consider using smaller keys, as suggested on other forums? JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
Hey Vlad, you have a couple of simple strategies here regarding logs. The first thing to know is that Mongo can generally handle lots of successive inserts without a lot of RAM. The reason for this is simple, you only insert or update recent stuff. So the index size grows, but the data will be constantly paged out. Put another way, you can break out the RAM usage into two major parts: index & data. If you're running typical logging, the data portion is constantly being flushed away, so only the index really stays in RAM. The second thing to know is that you can mitigate the index issue by putting logs into smaller buckets. Think of it this way. If you collect all of the logs into a date-stamped collection (call it logs20101206), then you can also control the size of the index in RAM. As you roll over days, the old index will flush from RAM and it won't be accessed again, so it will simply go away. but I am also considering using a cron script that dumps and deletes old data This method of logging by days also helps delete old data. In three months when you're done with the data you simply do db.logs20101206.drop() and the collection instantly goes away. Note that you don't reclaim disk space (it's all pre-allocated), but new data will fill up the empty spot. Should I also consider using smaller keys, as suggested on other forums? Yes. In fact, I have it built into my data objects. So I access data using logs.action or logs->action, but underneath, the data is actually saved to logs.a. It's really easy to spend more space on "fields" than on "values", so it's worth shrinking the "fields" and trying to abstract it away elsewhere.

Related questions

0 votes
    What is the memory limit in R for 64 bit system? (a) 8 TB (b) 9TB (c) 10TB (d) 16TB The ... Functions and Debugging of R Programming Select the correct answer from above options...
asked Feb 15, 2022 in Education by JackTerrance
0 votes
    What is the memory limit in R for 32 bit system? (a) 8 TB (b) 9TB (c) 10TB (d) 3GB The ... Functions and Debugging of R Programming Select the correct answer from above options...
asked Feb 13, 2022 in Education by JackTerrance
0 votes
    R suffers from the disadvantage of being restricted to the local memory. Could you elaborate the precise memory limit in R?...
asked Oct 16, 2020 in Technology by JackTerrance
0 votes
    I am paginating users and in my view I have: I want to limit li.profile to 200 characters ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 11, 2022 in Education by JackTerrance
0 votes
    I get an java.lang.OutOfMemoryError: GC overhead limit exceeded when run gradle on Android 1.4 ... ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 11, 2022 in Education by JackTerrance
0 votes
    I mean this Datepicker: https://uxsolutions.github.io/bootstrap-datepicker/ HTML: Fecha de inicio Fecha de ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 10, 2022 in Education by JackTerrance
0 votes
    I would like to achieve the following using RxJs: Group message that are within ~200ms of the previous ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 7, 2022 in Education by JackTerrance
0 votes
    I would like to achieve the following using RxJs: Group message that are within ~200ms of the previous ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 24, 2022 in Education by JackTerrance
0 votes
    Has anyone found a way to get around this? Or a better technique to conglomerate logging from multiple web ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 16, 2022 in Education by JackTerrance
0 votes
    Which of the following is used to limit the number of rows returned? (a) setMaxRows(int i) (b) setMinRows(int ... Beans & JDBC of Java Select the correct answer from above options...
asked Feb 22, 2022 in Education by JackTerrance
0 votes
    I have two lists, same size, one is y_data and one is x_data x_data is a time hh:mm:ss during ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 18, 2022 in Education by JackTerrance
0 votes
    When you setup an Auto Scaling groups in AWS EC2 Min and Max bounds seem to make sense: The minimum number of ... is larger than Min? Select the correct answer from above options...
asked Feb 8, 2022 in Education by JackTerrance
0 votes
    I am using jquery, JSON, and AJAX for a comment system. I am curious, is there a size limit on ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 7, 2022 in Education by JackTerrance
0 votes
    I am using jquery, JSON, and AJAX for a comment system. I am curious, is there a size limit on ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 5, 2022 in Education by JackTerrance
0 votes
    I would like to know if Firebase Cloud Messaging is free or not for unlimited users? Select the correct answer from above options...
asked Feb 1, 2022 in Education by JackTerrance
...