(For a video version of this frequently asked question and answer, click this link.)
Because compositions and computer systems vary greatly, there is no one right answer to this question. A good start toward an answer, though, is here:
"Please try recommended memory settings for After Effects CS5 and give feedback."
Here are a couple of pages that go into detail about considerations for memory and multiprocessing settings:
"Performance tip: Don't starve your software of RAM."
"Performance tip: Don't overschedule your processors"
More performance improvement tips:
Information about RAM usage in After Effects: