Mmmm…. might be wrong, but I probably see where your problem is.
Most document management systems have problems when the quantity of documents contained in a virtual "folder" (or space, to use Alfresco's terminology) increases.
I would also expect performance problems in doing queries on very large spaces.
In the past I worked on commercial products that were showing a noticeable performance degradations (mostly in searching and browsing content in folders) when the quantity of documents in a folder was over 500-1000 items.
Maybe Alfresco's architecture is different and it can easily handle spaces with hundreds of thousands of documents, or even millions of documents.
But in designing your application, I would suggest to try to implement an automatic "space splitting" algorithm capable of keeping the number of items in the space down to a reasonable limit, and see if this improves the performance of your application.
From a broader point of view, a comment from Alfresco's engineers here would be greatly appreciated:
1) what is the "reasonable" number of items that - according to the product architecture and the tests you've done so far (I'm thinking about the Unisys benchmark, for instance) - can be stored in a Space without incurring in performance degradations?
2) what "repository design" practices are recommended for applications that need to store more than one millions of documents?