mysql - Trade off between reading from database and memory storage of Java strings using servlets -


I am in the process of installing a system that will repeatedly parsize text in a large amount (string or stringbuffer - Which can be better?) Text obtained from any data source will be displayed and it can contain thousands of words and every time the text is parsed, each word needs to be examined against the list of 550 stop words May be. It will allow the words filtered with the display.

So I'm surprised about the performance because it can be running in more than one sublet session at any time; Is it better to check each word using any index against a MySQL database table (MySam or INODB)? Or just store 550 words within the servlet reference in a Java array or array so that they can possibly be read more quickly?

So I think about trading between database IO against archiving 550 wires in memory.

Any advice?

Thanks Morgan

Assuming that "data source" is not your database, you can get better performance by stopping the board Instead of searching for a database, do a search in the store. The reason for this is:

  • Any algorithm that the database can be used in the same way as your in-memory algorithm.
  • By running the algorithm locally, avoid the cost of sending text to the database and sending the results back.

It may also be that you can apply a better algorithm to find stop-terms than normal-purpose database engine. And memory required for the data structure representing 500 or more studded compared to the rest of your data, servlet container and the location used by all the libraries you use.


Comments