tags:

views:

369

answers:

3

Hi,

I'm trying to troubleshoot an enterprise application of sort running at a customer's site.

The application, which is actually a search engine, is eating 99% CPU but almost no more RAM than when IDLE. No dramatic I/O or Network activities were registered as well.

My question is: is the application badly designed? Could any application become more RAM hungry if it was designed properly? and in short: When can CPU and RAM be interchangeable?

Thanks!

+2  A: 

Not that much information to go on, but heavy CPU load and virtually no RAM load (assuming it is causing performance problems) could be a good sign that you need to implement a caching model of some sort. If the service is being hammered (really hammered!), even a cache of 1 second can result in a huge performance boost. There could be a good reason why the data can't be cached though.

Or the service could just be sat in a while loop eating all the CPU cycles for all I know :)

Steven Robbins
Cache sounds like the obvious solution, but one thing is that the I/O (I'm assuming disc I/O) isn't high. I would expect that if the search isn't caching, then it's hitting the storage device to reprocess data.
Sam
Thanks for your response. So basically the only way to encourage more RAM usage and less CPU would be caching? I'm assuming this is not caused by a complete design flop as this is a leading software product.
adilei
I would say starting with the FAQ of the product is where to start. Try searching for caching or some option to increase the size of the search index as well. Caching and Indexing are really main stream concepts and would be expected in any main stream application.
Sam
@Sam Just because the DATA could potentially be cached by the backend, doesn't mean the processing of the result is. If it's computationally expensive to compute the results, caching the relatively cheap to retrieve data won't do much :)
Steven Robbins
adilei: It's worth speaking to the manufacturer, there may be a set of "best practices" for setting it up that haven't be followed. Although they might just tell you to get a bigger CPU :)
Steven Robbins
@Steve Robbins: Excellent Point! Generally, I just expected the search engine to be searching poorly through the backend data. I didn't account for an expensive processing of the data.
Sam
A: 

A quick note about CPU and RAM interchangability. Generally speaking there is a direct link between speed and data storage. The more storage an algorithm uses, the faster it can perform. Though this concept is not a direct correlation to CPU and RAM, it is similar. That's where caching comes in and could possibly increase performance of the search algorithm and thereby decrease CPU utilization.

Sam
Sam - by caching do you mean result caching, or caching some temporary information while still computing?
adilei
Here, by "caching", I mean index caching. In the previous comment "caching" meant Result caching. Sorry for the ambiguity.
Sam
@Sam: So basically writing index data to an in memory data structure and then flushing batches of that data to the disk, as to prevent multiple I/O operations? Would that reduce CPU load?
adilei
@adilei: That's one optimization concept. I was speaking in generalities. It could also be that building the actual index data could be sped up by utilizing more RAM. (Speeding up the algorithm could potentially lower CPU utilization)
Sam
A: 

It sounds like the main loop is not turning over any spare CPU time to the OS. If the application is running under Windows then placing a Sleep call into the main message loop is a simple way to control this. Although, if you leave it as-is, when other applications require some CPU time, Windows should do something to ensure that they get some.

jheriko