  The Internet of Things is transforming our society by monitoring users and
infrastructures' behavior to enable new services that will improve life quality
and resource management. These applications require a vast amount of localized
information to be processed in real-time so, the deployment of new fog
computing infrastructures that bring computing closer to the data sources is a
major concern. In this context, we present Mercury, a Modeling, Simulation, and
Optimization (M&S&O) framework to analyze the dimensioning and the dynamic
operation of real-time fog computing scenarios. Our research proposes a
location-aware solution that supports data stream analytics applications
including FaaS-based computation offloading. Mercury implements a detailed
structural and behavioral simulation model, providing fine-grained simulation
outputs, and is described using the Discrete Event System Specification (DEVS)
mathematical formalism, helping to validate the model's implementation.
Finally, we present a case study using real traces from a driver assistance
scenario, offering a detailed comparison with other state-of-the-art
simulators.
