Can you please suggest easiest way to add huge amount of users into Groups without impacting performance of application.
Ehm - are you really sure you want to add 100.000 users directly to a group? Are there no abstract groups which you could use to build a hierarchy, avoiding the 100.000 members case?
Anyway, you will need to do Java-based batch processing, only adding a sub-set of the users per iteration. Adding 100.000 to one group in one go simply overwhelms all assumptions made when Alfresco core services were implemented... A batch of 25-50 should be a reasonable number. Using default cache configurations, I would not want to push it over (100 - #activeUsers), or risk performance issues due to transactional cache being full and triggering global cache clearing.
Lastly, I want to reiterate that you should consider if that is really the best way to go about your use case, and if you could not realise it in a different way. I personally would not add 100.000 users to a group. Such a case would warrant some small customisation within Alfresco to create a "virtual" group which does not really exist in the database, but is injected in a users list of authorities by applying the same rule you use to assign the users to group 1 or 2 (or both).