Welcome to the MongoDB Community.
It’s good practice to keep mongos (router) on the application server. But keeping primary on the application server wouldn’t be a good option I believe.
Why it’s not a good option:
- You will have all your read / writes pointing to the primary
- All of your indexes would be on primary
Both of above points will require amount of RAM possibly equal to your working data set if you want to get best performance.
In the case that you’ve mentioned, The application server would be already taking up some of your RAM to process the request / response. So it would be a good option to keep your Primary on separate node.
You’ve mentioned mongos but haven’t mentioned config server? I assume you’re running config server on the separate instance as well if you’re intended to run / apply sharding.
I am sure that you would have already checked on why to shard and when to shard. If not, This documentation will help you to decide considering the factors mentioned on that page. https://docs.mongodb.com/manual/sharding/.
I hope it answers your question!