IntroductionThis paper introduces a novel approach for optimizing service caching in smart buildings through the integration of Internet of Things (IoT) and edge computing technologies. Traditional cloud-based solutions suffer from high latency and resource consumption, which limits the performance of smart city applications.MethodsThe proposed solution involves a dynamic crowdsourcing and caching algorithm that leverages IoT gateways and edge servers. This algorithm reduces latency and enhances responsiveness by prioritizing services for caching based on a newly developed efficiency metric. The metric takes into account cloud and edge-computed response times, memory usage, and service popularity.ResultsExperimental results show a reduction in average response time (ART) by up to 25% and a 15% improvement in resource utilization compared to traditional cloud-based methods.DiscussionThese findings underscore the potential of the proposed approach for resource-constrained environments and its suitability for smart city infrastructures. The results provide a foundation for further advancements in edge-based service optimization in smart cities.