Magento provides a maintenance mode, it’s used when taking database backup and others
We can apply maintenance mode using command-line interface in this case connect SSH and go to Magento root dir.
When uploading something on a live website then need to enable maintenance mode
Maintenance mode enable command:
bin/magento maintenance:enable
Maintenance mode enable white list IP command:
bin/magento maintenance:enable –ip 198.168.00.00
Directory var/.maintenance.ip can contain a list of IP addresses
Maintenance mode disable command:
bin/magento maintenance:disable
Maintenance mode in a file when the website in developer mode
vendor/magento/framework/App/Bootstap.php
Maintenance mode in a file when the website in production mode
pub/errors/default/503.phtml
Hope the above things are clear!
Related : Magento 2 speed optimization