# Engineering Resource-Efficient Data Management for Smart Cities with Apache Kafka +
## 8 Outlook  
The MARVEL framework relies on distributed computation across the edge-fog-cloud continuum. To achieve this, enough resources must be available for the required usage of the components. It is worth noting that each of the nodes (at the cloud, fog, or edge) should be able to accommodate at least an MQTT broker and NiFi/MiNiFi and one inference model instance per camera/microphone stream used in the node. The current solution relies on deploying the anonymisation components also at the edge for privacy concerns, as well as a RTSP server to stream the AV data to the rest of the components of the framework after that. This imposes some minimal computational constraints, especially at the edge nodes. On the other hand, the framework is extensive enough to incorporate new AV streams by adding new pipelines composed of anonymisation components, RSTS streams, and inference models that output their results to the existing or new MQTT brokers (inference data) or to StreamHandler (AV data). Another point of extensibility is the possibility of adding new devices (e.g., fog or edge nodes) to the Kubernetes network, using MARVDash to facilitate the deployment of the MARVEL components in the new devices. The addition of inference models requires a more work, as appropriate pipelines should be set in DatAna to transform the outputs of the models to the Smart Data Models adopted in MARVEL, new topics for the models should be added to Kafka, and the DFB needs to store the new data into the Elastic Search. In this last case, new visualisations might need to be designed if the new data require it. The framework is based on microservices, i.e., containerised applications that are deployed across the computational resources in the E2F2C tiers. In this section, we provide a perspective on the long-term evolution of the framework by discussing a possible alternative software architecture, based on _serverless computing_, which could be used for data management in smart city applications. Serverless computing is a mature and trend ing technology in cloud computing [37], which greatly simplifies the orchestration and management process by providing the developers with a neat and simple abstraction: everything is a function. The developers code elementary functions, which are invoked by client applications or other functions, typically using HTTP methods. For this reason, the programming model of serverless computing is known as Function as a Service (FaaS). The number of instances deployed for a given function is dynamically adapted using autoscaling features so that only the resources actually needed at a given time are used; it is even common to enable so-called _scale-to-zero_, which means that if a function is not invoked for some time then all its instances are evicted from the run-time execution platform, which is very energy-efficient [38] even though it can lead to high-tail latencies due to cold-start effects [39]. Finally, the functions can be composed at run-time to produce the intended behaviour and each function can be substituted dynamically by onboarding a new version on the serverless platform, without the need to stop or restart the overall service: the resulting system is highly scalable and reliable. Serverless computing is efficient in the cloud for both stateless and stateful functions. A stateless function produces an output (a return value) that only depends on the input (arguments) provided, while a stateful one also has some application- or session-specific state that contributes to how the logic of the function behaves. In the cloud, the state is typically kept in an in-memory or storage service, which can be accessed by stateful functions as needed to retrieve, and update, the state upon each function invocation. The process is efficient due to the logical proximity of the serverless platforms and state management services and their fast interconnection in data centres.