简体   繁体   中英

MongoDB Performance for Calculations

Currently developing some engineering software using PHP and MongoDB for storing the data. I plan on doing some calculations where I am performing many calculations on a collection. Essentially, it contains data, and I want to perform calculations on the data, update the field, calculate on the next field and so on.
However, my developer has hit a snag. He was doing what I thought would be a simple operation.

> Upload a CSV into a collection.
> Create secondary collection by transforming all of the values 
> of the first collection according to user input of a value into a formula.

Similar to Excel's "Copy Value" then Paste Special Multiply. Essentially create a new collection as product of the first collection.

The developer reported back that this slowed his PC down to a crawl.
This concerns me that my advanced application has no hope of getting off the ground if mongo is slow to carry out this simple (to me) task.

Is there a proper way to go about performing thousands of calculations on a nosql collection? Are databases not meant for this sort of work load? Would I then have to pull the data out into an array, perform the calculations then insert the new values after the simulation is done? I have read that java has better performance than PHP, should I direct the code toward java for engineering applications?

There are few questions needs to be checked before coming to any conclusion

1) What is the OS? for windows check the task manager for the mongod process details while you are running the queries; for linux use the top command to check the process details

2) What is the volume of data; I mean size in terms of megabyte/byte

3) If you have 2 GB RAM then you should consider splitting the data volume to less than 1 GB and start processing

4) If data volume is perfect for the RAM size then there must be disk speed/ RPM

5) If the data processing is only for localhost then you can process the data with some other laptop with higher configuration to see the outcome

6) What is the version of MongoDB you are using? try to upgrade to the latest

7) You can consider free MongoDB cluster Atlas( https://cloud.mongodb.com/user#/atlas/login ) if the volume of data is not very huge

8) Can create a cluster in AWS free tier for few hours to know the outcome also

I hope you are shy away from trying. Last but not the least is your requirement.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM