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:
Here are a couple of pages that go into detail about considerations for memory and multiprocessing settings:
More performance improvement tips:
Information about RAM usage in After Effects:
Europe, Middle East and Africa