Need knowledge to calculate Namenode java heap size and number of files which can allow on java heap size

Hello Team,

If i want to allow 8 millions of files what should be the Namenode java heap size ? I refer hortonworks documentation but not able to understand calculation. Can you please help

https://docs.hortonworks.com/HDPDocuments/HDP2/HDP-2.4.2/bk_installing_manually_book/content/ref-80953924-1cbf-4655-9953-1e744290a6c3.1.html