Skip to main content

Availability and Fault Tolerance

  • Chapter
  • First Online:
Mobile Applications
  • 1011 Accesses

Abstract

This chapter explores provisions to incorporate redundancy in mobile apps so that the critical functions are always available. Section 9.1 highlights the significance of broadcast communication and design diversity in the constructions of high availability architectures. Subsequent sections demonstrate the use of these building blocks in the creation of high availability mobile apps on smartphones. Leveraging network communication alternatives available on smartphones, Sect. 9.2 presents creation of highly available emergency communication and alerting solutions for smartphones. Section 9.3 outlines a sensor data fusion architecture that leverages diversity and redundancy of large number of sensors available to a mobile app either directly on the smartphone or indirectly via its network interfaces. Such data fusion-based solutions are purposed with providing an accurate context even if, at times, some of the sensors become temporarily unavailable. Section 9.4 studies synchronization and replication complexities of data management when smartphones are involved. In addition to hardware/software failures and battery outages, impact of frequent network outages, often as a result of mobility, on the availability of critical data is examined and addressed in this section. Finally, longer battery life can keep a smartphone operational for a longer time until the opportunity to plug in the smartphone and recharge the battery. Section 9.5 therefore lists measures that mobile apps could take to avoid wastage of battery power and prolong the availability of critical functions.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

eBook
USD 16.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Hardcover Book
USD 99.99
Price excludes VAT (USA)
  • Durable hardcover edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

References

  1. A. Avizienis, “The N-Version Approach to Fault-Tolerant Software,” IEEE Transactions on Software Engineering, vol. SE-11, no. 12, pp. 1491–1501, December 1985.

    Article  Google Scholar 

  2. V. Hadzilacos and S. Toueg, “Fault-tolerant broadcasts and related problems,” in Distributed Systems, S. J. Mullender, ed., New York, ACM Press & Addison Wesley, 1993.

    Google Scholar 

  3. J. Huang, et al, “A Close Examination of Performance and Power Characteristics of 4G LTE Networks,” in ACM MobiSys, June 2012.

    Google Scholar 

  4. RFC 5944 IP Mobility Support for IPv4, November 2010.

    Google Scholar 

  5. RFC 4960 Stream Control Transmission Protocol, September 2007.

    Google Scholar 

  6. K.-K. Yap et al, “Making Use of All the Networks Around Us: A Case Study in Android,” CellNet’12, August 2013.

    Google Scholar 

  7. S. Nirjon et al, “MultiNets: A System for Real-Time Switching between Multiple Network Interfaces on Mobile Devices”, ACM Transactions on Embedded Computing Systems (TECS), vol 13. April 2014.

    Google Scholar 

  8. IEEE 802.11-2016 Standard

    Google Scholar 

  9. www.bluetooth.com

    Google Scholar 

  10. www.nearfieldcommunication.org

    Google Scholar 

  11. C. Wang et al, “Multi-sensor fusion method using kalman filter to improve localization accuracy based on android smart phone”, in IEEE International Conference on Vehicular Electronics and Safety, 2014.

    Google Scholar 

  12. J. Guiry, Pepijn van de Ven and J. Nelson, “Multi-Sensor Fusion for Enhanced Contextual Awareness of Everyday Activities with Ubiquitous Devices”, in Sensors 2014, pp. 5687–5701, https://doi.org/10.3390/s140305687.

  13. P. Tsinganos and A. Skodras, “On the Comparison of Wearable Sensor Data Fusion to a Single Sensor Machine Learning Technique in Fall Detection”, Sensors 2018. https://doi.org/10.3390/s18020592 (https://www.mdpi.com/1424-8220/18/2/592)

  14. I. Pires et al, “From Data Acquisition to Data Fusion: A Comprehensive Review and a Roadmap for the Identification of Activities of Daily Living Using Mobile Devices”, Sensors 2016, 16(2), 184; https://doi.org/10.3390/s16020184 (https://www.mdpi.com/1424-8220/16/2/184).

  15. H. Carvalho et al, “A general data fusion architecture”, in International Conference on Information Fusion, 2001, pp. 1465–1472

    Google Scholar 

  16. H. Min, P. Scheuermann and J. Heo, “A Hybrid Approach for Improving the Data Quality of Mobile Phone Sensing”, in International Journal of Distributed Sensor Networks, 2013, pp. 1–10

    Google Scholar 

  17. RFC 4918 HTTP Extensions for Web Distributed Authoring and Versioning (WebDAV), 2007

    Google Scholar 

  18. https://omaspecworks.org/

  19. A. Stage, “Synchronization and replication in the context of mobile applications”, 2005. http://wwwmayr.in.tum.de/konferenzen/Jass05/courses/6/Papers/11.pdf

  20. P. Bernstein, V. Radzilacos, and V. Hadzilacos, “Concurrency Control and Recovery in Database Systems”, Addison-Wesley, 1987

    Google Scholar 

  21. G. Coulouris, J. Dollimore, and T. Kindberg, “Distributed Systems: Concepts and Design”, Pearson, 5th edition, 2011

    MATH  Google Scholar 

  22. RFC 6455 The WebSocket Protocol, 2011

    Google Scholar 

  23. H. Petander, “Energy-aware network selection using traffic estimation”, in 1st ACM workshop on Mobile Internet through Cellular Networks, 2009, pp 55–60.

    Google Scholar 

  24. A. Rahmati and L. Zhong, “Context-for-Wireless: Context-Sensitive Energy-Efficient Wireless Data Transfer”, MobiSys’2007 Fifth International Conference on Mobile Systems, Applications and Services, 2007, pp. 165–178

    Google Scholar 

  25. G. Kalic, I. Bojic and M. Kusek, “Energy Consumption in Android Phones when using Wireless Communication Technologies”, in MIPRO’2012, pp. 754–759

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Exercises

Exercises

9.1.1 Review Questions

  1. 9.1

    Determine the number of variants needed for the high availability architectures of Fig. 9.1 to have the overall availability of 0.99 if the availability of each variant is 0.6.

  2. 9.2

    Suppose a personal safety app, after detecting an emergency situation reaches out to the emergency contact first by phone call and, if that fails, then using Skype. Only after these two successive attempts fail then the app uses both the SMS and WhatsApp variants to send the panic alert concurrently. Again, assuming 0.8 to be the availability of each variant, including the controller, estimate the overall availability of the app.

  3. 9.3

    A key deciding factor when switching between mobile data network and WiFi is to minimize disruption to TCP connections that are active at that time. Identify APIs or system calls that can help an Android module or an app controlling vertical handoffs determine the number of TCP connections that the smartphone is currently supporting and the data activity in each of these connections.

  4. 9.4

    Suggest changes to the Linux kernel and/or Android stack that would enable more than one network interface at the same time and allow simultaneous transmission of data through these interfaces.

  5. 9.5

    Discuss how SCTP’s multi-homing feature could be repurposed to support make-before-break vertical handoff in heterogeneous networks.

  6. 9.6

    Suppose a mobile app is streaming content over HTTP while connected to a WiFi AP.

    1. (a)

      Would the TCP connection break if the smartphone moves away from the currently connected WiFi AP to another AP given that:

      1. (i)

        Both APs are in the same network.

      2. (ii)

        They are in different networks, and hence the IP address of the smartphone will change.

      Assume that in both cases the two APs happen to be situated next to each other and the drop in the signal strength as the smartphone moves from one AP to another is not significant enough to disrupt connectivity.

    2. (b)

      What IETF protocols could be employed for maintaining persistence of TCP connections during such mobility scenarios?

    3. (c)

      Suppose a Voice over IP call was in progress when the smartphone moved from one AP to another as above. Given that VoIP runs over UDP and not TCP, how is the continuity of the call maintained as mobile moves from network to network requiring change in its IP address.

  7. 9.7

    Propose strategies to ensure atomicity of normal and ordered broadcasts, respectively.

  8. 9.8

    Although sticky broadcasts have been deprecated in Android, discuss the role sticky broadcast or sticky ordered broadcast could have played in the manifestation of some of the broadcast primitives discussed in this chapter. For example, could sticky ordered broadcast have made it easier to ensure that the crashed receiver receives the broadcast upon recovery?

  9. 9.9

    Provide fault tolerance examples where atomicity and/or order of the broadcast is required.

  10. 9.10

    What are the implications of registering a broadcast receiver using application versus Activity context?

  11. 9.11

    What are the implications of registering a broadcast receiver programmatically versus via the Manifest file.

  12. 9.12

    True or False

    1. (a)

      The onReceive() method of the broadcast receiver is called on the UI thread of the app that registered it.

    2. (b)

      A broadcast receiver can be registered to run in a separate process.

    3. (c)

      A broadcast received can be registered to run in a separate thread.

    4. (d)

      A broadcast receiver created by a foreground service always runs.

    5. (e)

      Even if the broadcast is aborted, the receiver that the sender specified in the call will still be called.

    6. (f)

      All Android broadcasts pass through the ActivityManager.

    7. (g)

      The temporal order of broadcasts from different Activities to common receivers is maintained in Android.

  13. 9.13

    List any differences between specifying the reference to the last receiver in the sendOrderedBroadcast() method versus simply assigning it the lowest priority.

  14. 9.14

    What is the impact of sending the broadcast intent in the foreground versus background?

  15. 9.15

    Can registering a BroadcastReceiver via the Manifest file impact the battery drain adversely as compared to registering it programmatically? Explain using an example.

  16. 9.16

    What is the consequence of registering a ContentObserver via an Activity versus Service?

  17. 9.17

    In what scenarios higher GPS sampling rate may actually improve accuracy whereas in other scenarios it may simply cause unnecessary battery drain?

  18. 9.18

    Android’s Location API allows number of GPS satellites visible at a time to be queried. What could be a possible use of this information?

  19. 9.19

    Compare the use case for BluetoothAdapter.startDiscovery() versus BluetoothLeScanner.startScan() when discovering Bluetooth devices.

  20. 9.20

    Discuss benefits of fusing data from the onboard accelerometer, magnetometer, and gyroscope sensors to the GPS readings.

  21. 9.21

    List sensors whose fusion with user’s smartphone accelerometer can improve reliability and confidence in the Personal Safety app.

  22. 9.22

    Consider a custom sync adapter implemented for the Mobile Calendar app to synchronize edits to the local copy of contacts and calendar to a remote copy. Suppose a community care nurse using the Mobile Calendar app performs the following changes in the local copies of contacts and calendar.

    1. (i)

      The work phone number of a contact was changed.

    2. (ii)

      As requested by a senior, who receives service from 9:30 to 10:30 AM every Monday, Wednesday, and Friday of the week, the next Friday’s appointment has been moved to Saturday.

      1. (a)

        Propose a data model to store contacts as well as calendar entries for episodic and recurring events, and exchange format of such entries for synchronizing local and remote copies.

      2. (b)

        Using examples of realistic values in the local as well as remote copies of the above contact and calendar entries, highlight what values would result in a conflict during the above synchronization.

  23. 9.23

    Consider the infrastructure of Fig. 9.6 composed of participating smartphones communicating with each other via a web socket hub for data sharing purposes. Analyze the following replication strategies:

    1. (a)

      Each participating smartphone manages a replica locally using SQLite. The calls to beginTransaction(), setTransactionSuccessful(), and endTransaction() along with any DML operations are forwarded, as they arrive, to all the replicas that are available at that time, whereas only local replica is used for queries. Would this replication strategy ensure one-copy serializability in the presence of not only site failures (i.e., a smartphone/app crashing or battery outage) but also loss of connectivity to the hub? Verify your answer by assuming T1 and T2 of Sect. 8.3.1 launched on mobiles M1 and M2, respectively, with M1, M2, and M3 each managing a replica in their respective SQLite database. Suppose T1 started first, but after executing the very first select statement on the local replica, M1 lost connectivity to the network and thus the hub. T2 meanwhile also started on M2 to run concurrently. M1 regained connectivity after a long time. Determine the values of the vitals and medicine dose at each replica after the two transactions had concluded.

    2. (b)

      A quorum of available replicas is established as a transaction starts. The quorum is not changed until the commit. If a replica fails or becomes unavailable, the transaction blocks and waits for the replica to become available again. The calls to beginTransaction(), setTransactionSuccessful(), and endTransaction() along with any DML operations and queries are forwarded, as they arrive, to all the member replicas of the quorum. Versioning of data is maintained as the data gets updated. For a query, the data with the latest version is used, and the outdated member replicas are updated. Determine if such incorporation of Quorum Consensus with Versioning would ensure one-copy serializability.

    3. (c)

      Suggest and verify a replication strategy that would ensure one-copy serializability in such infrastructure, but also minimize blocking of transactions when site or communication failures occur.

  24. 9.24

    Consider the Mobile Calendaring app being used by community care nurses. As nurses generally work a predetermined schedule, the transactions are not likely to have conflicts, and thus they can work disconnected from the master copy by using the local copy, and any conflicts could be resolved as they connect to the master copy at the end of their shifts. Suggest rules to resolve conflicts for such offline optimistic concurrency control scenario.

  25. 9.25

    List possible benefits of onboard accelerometer, magnetometer, gyroscope, proximity, and light sensors in maintaining the quality of experience of a video call while avoiding unnecessary battery drain during the call.

9.1.2 Lab Assignments

  1. 9.1

    Create three variants of an Android component/service developing one variant in Java, another variant in Kotlin, and the third variant as a native component of React Native (or cross-platform development environment of your choice). Evaluate the diversity in these three variants in terms of their ability to achieve fault tolerance.

  2. 9.2

    Augment Listing 9.1 so that the MDN to WiFi switching takes into account the signal strength of the MDN as well as the WiFi AP.

  3. 9.3

    Experimentally determine how long the onReceive() method of a BroadcastReceiver can run on the main thread before returning but still avoiding ANR. Determine how much longer if the onReceive() method ran on a separate thread or the BroadcastReceiver was not in the foreground.

  4. 9.4

    Enhance the fail-over architecture of Listing 9.2 so that the variants are able to return the results to the calling Activity.

  5. 9.5

    Investigate the role of accessibility service in interacting with the GUI of third-party instant messaging and voice/video over IP apps as well as the onboard phone app launched using implicit intents to ensure that panic alerts are successfully sent, emergency calls go through, and any failures are accurately detected.

  6. 9.6

    Test Android’s host card emulation support by creating an app that implements a custom NFC card emulation service by extending HostApduService and attaching the smartphone’s back to another smartphone’s back running a card reader app and displaying the detected card.

  7. 9.7

    Implement a custom SyncAdapter to synchronize changes to the local ContactsContract and CalendarContract to Google calendar.

  8. 9.8

    Create an Observer for a SQLite database, and combine it with a SyncAdapter to propagate any observed changes in the local database to a remote.

  9. 9.9

    Experimentally verify the answers to 9.23 (a) and (b).

  10. 9.10

    Assume that the user is moving with constant speed in a particular direction, in a constant motion. Experimentally determine the impact on battery drain when GPS location updates are requested periodically versus whenever the user moves certain distance. Which strategy drains more battery?

  11. 9.11

    Experimentally determine if transmitting multiple files concurrently over the network saves battery as opposed to transmitting these files one at a time. Determine the maximum number of files that could be transmitted concurrently without incurring congestion. Repeat the experiments on WiFi as well as Cellular Data Network, and compare the results.

Rights and permissions

Reprints and permissions

Copyright information

© 2022 Springer Nature Switzerland AG

About this chapter

Check for updates. Verify currency and authenticity via CrossMark

Cite this chapter

Randhawa, T.S. (2022). Availability and Fault Tolerance. In: Mobile Applications. Springer, Cham. https://doi.org/10.1007/978-3-030-02391-1_9

Download citation

  • DOI: https://doi.org/10.1007/978-3-030-02391-1_9

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-030-02389-8

  • Online ISBN: 978-3-030-02391-1

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics