The Bluetooth Low Energy (BLE) is one of promising technologies widely used for Internet of things (IoT) services because of its low energy consumption. In IoT, BLE gateways should discover surrounding BLE devices in a short time, regardless of the number of BLE devices in surround. However, this requirement is difficult to achieve when the number of BLE devices is very large. As the number of BLE devices increase, the signal density increase, and the collision problems become more serious. Serious signal collision results in a long discovery delay. On the other hand, high signal density leads to a short average scanning time for each broadcasting signal. In this paper, we analyze the performance of BLE by considering both signal collision and density. Also, we proposed a scheme to estimate the number of surrounding BLE devices, and based on this estimation the optimal AdvInterval could be calculated which make the BLE gateway discover surrounding BLE devices as soon as possible. According the optimal Advinterval, BLE gateway could detect the disappeared devices which move out to the BLE communication range or battery was dead. The simulation results show us that the relationship between AdvInterval and scanning time. Also, according the simulation, we could find that there exists the optimal AdvInterval for given number of BLE devices to minimizes the scanning time.