The phrase "the sun never sets on the British Empire" was an adaptation of a saying used in earlier times to describe other empires. By the turn of the 20th Century, its British version was in regular use. It denoted territorial holdings by a major colonial power in such a vast sweep of the known world that, somewhere in that empire, the sun was shining.
The British drive for empire did indeed stretch across the globe, from North America to the Far East. In order to secure those territorial holdings, and the wealth that came with them, military forces had to be deployed across the expanse. That required a series of ports that would enable the British Navy to sail along the stretches of the empire, protecting sea routes from pirates and from other imperial countries for mechant shipping. Similarly, that merchant shipping, necessary to transport exploited resources from colony to England, required ports suitable for the size of vessels in use.
The British colonial presence was extensive in Asia, including Malaya (now Malaysia) and Singapore, and in mainland China and Hong Kong, the turnover to China of which only occurred in 1997. A series of ports allowed British merchant and military shipping to control and exploit its colonial possessions.