Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8813835
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T03:57:32+00:00 2026-06-14T03:57:32+00:00

I want to store data on a MonogoDB. Therefore I have one mongos, three

  • 0

I want to store data on a MonogoDB. Therefore I have one mongos, three configserver and a sharding set that consists of two replicasets (each with prim./sec./arbiter).

I have two problems

1) Whats the best way to measure the time that is needed to store all the data?

by now I execute “time mongo 141.100.55.72:25001/mydb –quiet /data/javascript/insert.js” via the mongos (insert.js is the javascript descriped later)

I want to measure multiple operations – whats a good way to store each output in a file (working on ubuntu server)

2)The measured time is really really slow -e.g.: The execution needs about 5 min. for 100.000 dataobjects..

How can I speed up the performance?

the javascript looks like this: (I’m creating testdata ; the sharding key is a iteration just for testing (key:x) – could that cause the low performance?)

var amount = 100000/4;
var x=1;
var doc= "";

for (i=0; i<amount; i++)
{
doc = { datetime: '1119528044', att2: '...', key: x,...} //14 attributes
db.mycol.insert(doc);
x=x + 1
}

for (i=0; i<amount; i++)
{
doc = { datetime: '1219268044', att2: '...', key: x,...} //14 attributes
db.mycol.insert(doc);
x=x + 1
}

for (i=0; i<amount; i++)
{

doc ={ datetime: '1355851700', att2: '...', key: x,...} //14 attributes
db.mycol.insert(doc);
x=x + 1

}


for (i=0; i<amount; i++)
{ 
doc = { datetime: '1444851704', att2: '...' key: x,...} //14 attributes
db.mycol.insert(doc);
x=x + 1
}

Furthermore I’m not sure how to check if the data is on both replicasets – what would be the best way to check that?

best regards

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T03:57:33+00:00Added an answer on June 14, 2026 at 3:57 am

    By running time mongo you are adding a lot of extra time with the process to open, establish a connection, and finish the entire script.

    Is that what are you trying to mesure? or the amount it takes for every insert to be replicated/stored in a shard?

    If you want to run the script inside the shell:

    function measure_time() {
     ...
    }
    > var d = new Date(); measure_time(); print('it took', Math.abs(d-new Date().getTime()).toString(), 'ms');
    

    And the measure how long it takes.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to store data in string form to MySQL. I have created the
I want to store a data structure thats a table with one column Strings
I am doing game for iphone.In that I want to store game data such
I want to store and retrieve data that is accessible to all activities in
I want to store JSP session data in a custom store (the one I
I have a relatively simple case. I basically want to store data about links
Well i have a QIODevice where i want to store data. But have issues
I want to store data with every request (what user viewed what page of
I am a new developer on Android and I want store user data in
I want to store some data during my site viewing. Sometime i need to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.