Nested Documents, performance issues and read<write

21 views
Skip to first unread message

Daniel Drehmann

unread,
Jul 22, 2014, 5:29:24 AM7/22/14
to mongoos...@googlegroups.com
Hello. I am new to mongodb and mongoose and therefore I have some performance/improvement questions. In the past I did some applications with databases where performance was never an issue, but in my current project it is. It is a real time analytics tool.There I need to make very often updates (where I only insert small pieces of values to an array) and very few read operations. 

In my project I have the following schema for mongoose:

  var datawrapperSchema = new mongoose.Schema({
    name: {
        type:String,
        required: true
    },
    origin_id: {
        type:String,
        required: true,
        unique: true
    },
    datasets : [{
        key : { type:String },
        type : { type:String },
        values : [{
                value: String,
                timestamp: String,
                level: String
            }]
         }]
  });
 

As you can see an array of datasets is nested in my datawrapper and an array of values is nested in my datasets. Is this good practice or should I try to separate the schemas for performance?

Now I want to update very often the values in my datasets. I think for a faster update performance I should use separated schemas to address the datasets directly. I noticed that the roundtrip time (from client to backend,write update in db, and back to frontend) increases in time. The first roundtrip times are 40 ms and after 5 minutes they are around 200 ms. Is can't imagine that this should be normal.

Another problem is that my read operations on datawrappers which get updates are really slow. I heard of an global lock and write>read, but how to solve this? 

Thanks for your help!

Sergey Lyubka

unread,
Jul 22, 2014, 5:30:24 AM7/22/14
to mongoose-users
Wrong mailing list.


--
You received this message because you are subscribed to the Google Groups "mongoose-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongoose-user...@googlegroups.com.
To post to this group, send email to mongoos...@googlegroups.com.
Visit this group at http://groups.google.com/group/mongoose-users.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages