MongoDB Connection Overload

I am using the MongoDB latest driver version(2.13.1) for my Application. I am using Singleton Class to create the Mongo client object to specify my connection setting and reusing it throughout my Application. Here I have set the max pool size to 500. My doubt is do I have to specify timeout, Queue Size etc. in my application for the application to work efficiently or will the driver handle it for me. My application can have a huge number of users which will access the application at the same time. So I have tested some API handles with JMeter , Artillery. The JMeter couldn’t handle my target concurrency but all the insertions returned 200 ok response. So I used artillery to increase my concurrency and send about 9000 write requests per hour. My API only showed 40% average usage but out 0f 300000 request I sent, Only 120000 got 200 ok response and inserted correctly. Other entries got 503 error. What I want to know is this error caused by my API because it couldn’t handle that many requests or is the error from MongoDB ?
If it is from either of them how can I avoid getting such error and where should I configure the setting to achieve better performance and efficiency ?