First of all understanding this is not the standard installation and you need a lot of knowledge to success on it. It's not easy explaining all the problems you will find out during the process. But well I will try to give you some clues.
You need performance -> how ?
- Move Mysql in another server, totally separated, because you need to apply tunning configuration parameters to the database. Why do not use more than 8 cores ( we'll because I had migrated 2,5 milions of documents and with 8 cores I get best perfomance rather 10 and 12 ... the reason is quite complex to explaining, but has relation with disk I/O perfomance, writer buffers, OS etc... ). In your case I'm not sure, that's why in this scenarios is good idea having professional database and supported by specialized guys.
- More records means more problems from database -> obviously you can not decrease the number of documents, but should think in have as less as folders as possible, but at the same time folders with 1000-2000 documents, not more ( you must find the correct number ).
- You must disable all text extractors and also stop the crontab task "text extract"
- I do not understanding this folder structure "Root-->Portfolios-->PortfolioName-->PortfolioName_1-->Folder1" why ? depending the kind of problem might be other ways to storing data, and retrieving.
With small description of the data will store OpenKM, and how the third system will demand it ( for example -> invoices what will use invoice number to get back, or document uuid what is stored in the crm is used to retrieve the document. As you see here have two ways of interact between thirdparty application and OpenKM, this is one of the most important things to take in consideration, a bad decision here will get you better or worse performance ).
In this scenario only I suggest go for payment support ( OpenKM or another application ). Althought with payment subscription this kind of projects have a lot of problems and sometimes might fail. I ignore what is your experience on this scenario, but if this is your first aproach to this sizes I suggest for your safe expend money on supported version, will be more cheap than the hours and frustration migh be in the corner.
We can try to guide you from this forum, but this projects needs a lot of time, thinking and meetings, before taken a decision. In case repositories with more 5 milions I suggest go for payment supported database ( percona or similar guys can help on it, there's a cost, but also a reason for it ).