-1

I made a Java algorithm. It access the MongoDB database. It looks like they don't provide a method like .close() or .dispose(). SO I never use this kind of methods in the codes. Every time I run/debug the program, it becomes slower and slower. Is that any reasons or possibilities, generally or specifically?

4

1 回答 1

1

The specific problem is that you are probably not cleaning test data out of the database after each run.

But this is also telling you something important about your application's scalability; i.e. that it is likely to slow down noticeably in production as you add more and more data ... in some particular dimension. You should probably track down what is causing this problem now, rather than waiting until you run into operational problems.

The slow down that you are observing could potentially be a number of things, but I'd start by looking at whether your query performance could be improved by adding appropriate indexes.


I only retrieve. I don't insert new data.

That's what you say. In practice, something must be inserting data ... or something like that. It is hard to see what else could be causing the slowdown.

于 2012-10-02T02:52:23.850 回答