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 8469863
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T16:21:01+00:00 2026-06-10T16:21:01+00:00

I setup Mongo and everything works great. When I use MongoVUE or the shell,

  • 0

I setup Mongo and everything works great. When I use MongoVUE or the shell, everything is fast as lightning.

After installing the PHP Mongo drivers for Windows, though, every query takes upwards of 15 seconds. Even this simple tutorial from PHP.net takes 15 seconds.

Tutorial example:

    $time_start = microtime(true);
    // connect
    $m = new Mongo();

    // select a database
    $db = $m->comedy;

    // select a collection (analogous to a relational database's table)
    $collection = $db->cartoons;

    // add a record
    $obj = array( "title" => "Calvin and Hobbes", "author" => "Bill Watterson" );
    $collection->insert($obj);

    // add another record, with a different "shape"
    $obj = array( "title" => "XKCD", "online" => true );
    $collection->insert($obj);

    // find everything in the collection
    $cursor = $collection->find();

    // iterate through the results
    foreach ($cursor as $obj) {
        echo $obj["title"] . "\n";
    }
    $time_end = microtime(true);
    $time = $time_end - $time_start;

    echo "\nOperation took $time seconds\n";

Output:

Calvin and Hobbes XKCD Operation took 15.000731945038 seconds

I’m using Windows 7, WAMP, MongoDB 2.0.7 and the Windows PHP Mongo drivers (v1.1.12) from Github.

In answer to the question in the comments:

Q: Have you tested other PHP code on your system and the duration of it?
A: This is actually a small piece of a bigger web application and everything else works fine. I’d be happy to post any benchmarks you guys think would be useful.

Q: Have you profiled the query in Mongo?
A: Yes. If I run it through the shell, it gets a response instantaneously.

Q: What WAMP version is this?
A: WampServer 2.2

Q: What PHP version is this?
A: 5.3.13

Q: Has the mongodb already got data in it?
A: I dropped all my databases prior to the benchmark I posted, so all it has in it is the data being inserted by the code below.

Q: What is the specs of the computer (memory mainly)?
A: AMD Phenom II X4 840T 2.9GHz processor, 4GB DDR3 RAM, 64 bit OS

  • 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-10T16:21:02+00:00Added an answer on June 10, 2026 at 4:21 pm

    I agree 15 seconds is ridiculous. The tutorial code should be running closer to 0.5 seconds (if that) even with SafeMode on. You have SafeMode turned off as you can see by your insertion code:

    // add a record
    $obj = array( "title" => "Calvin and Hobbes", "author" => "Bill Watterson" );
    $collection->insert($obj);
    
    // add another record, with a different "shape"
    $obj = array( "title" => "XKCD", "online" => true );
    $collection->insert($obj);
    

    You are doing async inserts which means that the PHP code does not wait for a return from the DB, so in theory the call to the DB should not be the problem in your code.

    The find() could be causing problems though, so I would profile that.

    It is still possible that the driver is causing some kind of slow down but this is highly unlikely. To help us further:

    • Have you tested other PHP code on your system and the duration of it?
    • Have you profiled the query in Mongo?
    • What WAMP version is this?
    • What PHP version is this?
    • Has the mongod already got data in it?
    • What is the specs of the computer (memory mainly)?
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using the Mongo shell to query my Mongo db. I want to use
I am trying to setup a zf1 + doctrine mongo odm 1.0.0BETA4-DEV project. I
I want to setup Master Slave config for Mongo DB on my Ubuntu Machine.
I've been trying to setup a simple replication system. 1 main mongo, 1 backup,
I was trying to put the gridfs/nginx/mongo setup in place but I am getting
I'm using the node-mongodb-native driver with connect-session-mongo . When I use connect-session-mongo with the
I've got a Node.js, Express setup with Mongo and Mongoose written in CoffeeScript. I
I have an app setup with Rails 3.1, Mongo 1.4.0, Mongoid 2.2.4. What I
Newbie using mongo 2.0.1 32-bit on windows tried testing out shards as follows: (4)
I'm having problems with what seems to be a simple sharding setup in mongo.

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.