AWS - PHP MongoDB插入速度慢

I am facing a weird issue while inserting data to MongoDB configured in AWS. My code is written in CakePHP and it is also running in AWS server. To insert each entry in to MongoDB, it almost takes 2 0r 3 minutes and after inserting around 20 -25 rows of data, the execution stops without giving any errors.

I have checked CakePHP error log, MongoDB error log and AWS server error log, but did not get any information.

The version of CakePHP is 2.6 and the plugin used is https://packagist.org/packages/ichikaway/cakephp-mongodb and the version of MongoDB is 3.2.

It would be great if you can give some direction on this.

It does not have anything link to AWS or cakePHP,

This how you should do mongo query profiling

Step 1:- in the mongod.conf file add, this will log all the queries that are taking more than 100ms in the access logs of the mongo server.

 slowms = 100

Step 2:- through the below mentioned command you can directly check the current operations happening at the mongo db, second query will in particular provide you the queries taking more than 1second and running at that moment of time, this will prove to be a great help.

db.currentOp()
db.currentOp({ "active" : true, "secs_running" : { "$gt" : 1 }})

Step 3:- Once you get the queries which are taking time, you can do , it will explain the query, and will show you weather it is picking up any indexes or not, depending on that you can create the required indexes.

db.collectionName.query.explain()