← 總目錄 / Contents

Chapter 05 · Wireless Mobile Internet

無線流動互聯網|English + 中文

根據第 05 章講義整理;英文概念後附中文解說。 / Based on lecture 05; English explanations are paired with Chinese.

重點筆記 / Core concepts

Three-tier architecture

Client devices run apps, the proxy/gateway tier adapts communication, and servers provide data and application services. A proxy can transcode content, cache popular items, compress data and bridge protocols; it also adds a dependency and may need access to plaintext.

三層架構包括執行應用程式的客戶端、調整通訊的代理/閘道層,以及提供資料和服務的伺服器。代理可轉碼、快取、壓縮及轉換協定,但也增加依賴,並可能需要接觸明文。

Client approaches

A thin/web client reduces local installation but depends on network and browser capabilities. A smart client can exploit local storage and work offline but needs deployment, synchronization, security and conflict handling.

薄客戶端/網頁可減少安裝,但依賴網絡及瀏覽器能力。智能客戶端可利用本地儲存及離線操作,但要處理部署、同步、安全和衝突。

Caching and consistency

Caching reduces latency and repeated transfers but cached data may be stale. TTL bounds how long an entry is trusted without validation; invalidation reports identify changed items; validation checks versions. Longer TTL often saves traffic but raises staleness risk.

快取可減少延遲及重複傳輸,但資料可能過時。TTL 限制免驗證的信任時間;失效報告指出已更改項目;版本驗證確認內容。較長 TTL 通常減少流量,但增加過時風險。

Push, pull and synchronization

Pull requests data when needed; push broadcasts or delivers updates without each client requesting every item. Push suits popular common data; pull suits diverse or infrequent demands. During reconnection, compare versions and reconcile conflicting offline writes according to an explicit policy.

Pull 在需要時請求資料;push 主動廣播或發送更新,毋須每位客戶逐項請求。Push 適合大眾共同需要的資料;pull 適合分散或不頻繁需求。重新連線時比較版本,並按明確政策處理離線寫入衝突。

5.1 Thin and thick clients · Slides 3–8

A thin client relies more heavily on remote services and often needs less local deployment, but operation and responsiveness depend on connectivity. A thick or smart client performs more work and stores more data locally, allowing richer interfaces and some offline operation; this increases installation, updates, local security and synchronization responsibilities.

薄客戶端較依賴遠端服務,通常減少本地部署,但運作和反應速度依賴連線。厚/智能客戶端在本地進行較多處理及儲存,可提供較豐富介面與部分離線功能,但增加安裝、更新、本地安全及同步責任。

5.2 Operating system and application server · Slides 10–16

The mobile operating system manages applications, storage, networking, power and permissions. The application server implements business logic and accesses persistent data. A wireless gateway mediates between networks and may perform protocol conversion, authentication or content adaptation; these functions depend on the actual architecture.

流動作業系統管理應用程式、儲存、網絡、電量和權限。應用伺服器執行業務邏輯並存取持久資料。無線閘道在網絡之間協調,可執行協定轉換、認證或內容調整;實際功能取決於架構。

5.3 Synchronization and messaging · Slides 17–22

A synchronization server exchanges changes between client and server copies. A two-way sync can upload and download changes, while one-way sync moves changes in a specified direction. Simultaneous offline edits can conflict; resolution needs an explicit policy such as version checks and user review. A messaging server queues and routes messages when recipients cannot be reached immediately.

同步伺服器在客戶端與伺服器副本之間交換變更。雙向同步可上傳及下載,單向同步則按指定方向傳送。多方同時離線編輯可能衝突,須依明確政策處理,例如版本檢查及用戶覆核。訊息伺服器可在接收者暫時不可達時排隊並轉送訊息。

5.4 Proxy transcoding and caching · Slides 24–25

Transcoding transforms a representation, for example resizing a large image for a low-resolution display or lower-bandwidth connection. Caching stores a copy near the client to reduce repeated transfers and latency. The proxy needs to know device capabilities or preferences; transformation and storage can introduce quality loss, staleness and privacy concerns.

轉碼改變內容表示方式,例如把大圖片縮小以適合低解析度顯示器或較低頻寬。快取把副本放在接近客戶端的位置,減少重複傳輸及延遲。代理需要知道裝置能力或偏好;轉換和儲存亦可能帶來品質損失、過時及私隱問題。

5.5 Pull, push and hybrid · Slides 27–33

Pull: a client requests a specific item; bandwidth is spent when there is demand but many separate requests can be expensive. Push: the server sends updates or broadcasts popular items, potentially serving many clients together but wasting bandwidth on uninterested clients. Hybrid combines the approaches, for example broadcasting popular data and requesting uncommon items.

Pull:客戶端請求指定項目;有需求才使用頻寬,但大量獨立請求可能昂貴。Push:伺服器主動發送更新或廣播熱門項目,可同時服務多個客戶,但可能浪費頻寬給不需要的客戶。混合模式可廣播熱門資料,並按需請求冷門資料。

5.6 Disconnected operation · Slides 34–37

Before disconnection, hoard or prefetch anticipated data; during disconnection, read the local cache and record writes; after reconnection, synchronize and resolve conflicts. Prefetching the wrong items wastes storage and energy. An application should tell users when displayed data may be stale and when an update has not yet reached the server.

斷線前預先儲存預計需要的資料;斷線時讀取本地快取並記錄寫入;重連後同步及處理衝突。預取錯誤項目會浪費儲存及電量。應用程式應告訴用戶資料可能過時,以及更新何時尚未送達伺服器。

5.7 Invalidation report variants · Slides 38–48

A server may broadcast invalidation reports so clients can discard cached items changed since a relevant time. Stateful designs track client state; stateless designs avoid maintaining per-client cache state but may require reports covering an interval. Synchronous reports use scheduled times; asynchronous reports follow changes or other events. Disconnected clients need a strategy for missed reports, such as revalidation.

伺服器可廣播失效報告,讓客戶端丟棄自相關時間以來已變更的快取項目。Stateful 設計追蹤客戶端狀態;stateless 不維護每個客戶的快取狀態,但可能需要涵蓋某個時間區間的報告。Synchronous 在預定時間發送;asynchronous 可在變更或其他事件後發送。斷線客戶需要處理錯過報告,例如重新驗證。

逐頁講義原文 / Slide-by-slide source text

以下為講義英文文字的自動提取,讓你逐頁核對上方中英筆記及搜尋細節;它不是逐頁中文翻譯。圖表、公式排版及部分旋轉文字可能缺失,請以原 PDF 為準。
Automatically extracted English lecture text for checking the bilingual explanations. Figures, formula layout and some rotated text may be missing; consult the original PDF.
講義第 1 頁 / Lecture slide 1
                          Wireless Mobile Internet
講義第 2 頁 / Lecture slide 2
Outline
        Wireless mobile Internet architecture
        Key components
        Proxy services (Transcoding, Caching)
        Mobile data management
講義第 3 頁 / Lecture slide 3
Wireless Mobile Internet Architecture
        Wireless mobile Internet applications are based on the
        mobile client-server model with the three-     tier architecture
               Client tier: Mobile devices (smartphones, tablets, IoT sensors)
               Proxy tier: Gateways, proxies
               Server tier: Application servers, synchronization server, messaging
               server, data storage
             Client Tier                      Proxy Tier                                                                      Server Tier
                                                                                           Application
                                             Wireless                                        Server
                           Wireless          Gateway
                            Network                          Wired                       Synchronization
                                            🌐🌐              Network                          Server
               Mobile                   Base
               Device                  Station                                             Messaging                   Data Storage
                                                                                             Server
講義第 4 頁 / Lecture slide 4
Wireless Internet Architecture
    Two architecture types
          Thin client architecture
                Use the same c/s architecture as Internet application.
                Business logic and data are stored on the fixed server side.
                 Client-side mobile device uses a  microbrowser to display the
                information; no other software is required on the client device.
                Client-side device needs a persistent connection to networks; The
                microbrowser handles the communication with wireless networks.
                Typically used for information service  applications.
          Thick client (smart client) architecture
                Application software is installed on the client device.
                It incorporates mobile database technology to provide persistent data
                storage management and data synchronization to enterprise systems.
                Client application can have some “smarts” or business logic to process
                data.
                It can access application data even when disconnected from the network.
                Most suitable for applications in ‘occasionally connected’ environments.
講義第 5 頁 / Lecture slide 5
Thin Client Advantages
       Extend internet computing applications to mobile
       environments.
       Need minimal to zero software deployment
             configuration.Applications are deployed without any additional client-side
             Entire configuration, adaptation and updating only take place on the
             server.
       Keep fresh data
             All of the data used are the latest version; no stale data.
       Provide high data security
             client side.All the data is stored on the server side; no data is stored on the
講義第 6 頁 / Lecture slide 6
Thin Client Disadvantages
      Need persistent wireless connectivity
            Hard to maintain persistent connectivity when a user moves
            between different locations.
      Application performance is highly affected by network
      conditions
            Each request being transferred over a wireless network is affected
            by the network throughput and latency.
      Availability
            If a problem occurs on the server side, all users will be blocked.
      Application testing is difficult
            Testing the application is difficult on the full range of microbrowsers.
            Emulators are not accurate representations of the end user’s
            experience since it is not executed over a wireless network.
講義第 7 頁 / Lecture slide 7
Thick Client Advantages
      Offline data access
            Even when no wireless is available, the user can still access and
            modify the application data. This overcomes the limitations of thin
            client architecture.
      Performance
            Performance is known and determined by the mobile device’s
            processor speed, data access, etc.
      Distributed computing
            Executing and processing data on the client side reduces server
            load.
      Security
            Control user data on both the client side and the server side; no
            third-party systems are involved.
講義第 8 頁 / Lecture slide 8
Thick Client Disadvantages
        Application deployment
               As the application needs to be deployed to mobile devices,
               deployment and management of applications become a burden.
        Development complexity
               Developing apps for various mobile devices with different mobile OS
               is difficult.
        Security risk
               Mobile OS opens doors to viruses.
講義第 9 頁 / Lecture slide 9
Outline
        Wireless mobile Internet architecture
        Key components
        Proxy services (Transcoding, Caching)
        Mobile data management
講義第 10 頁 / Lecture slide 10
Mobile Device Platform
      Mobile device features
            Form & usage
                  Portable, lightweight, small screen; always with the user; wide variation
                  in design and usage.
            Hardware
                  Limited CPU computation, small memory/storage, limited battery, rich
                  graphics display.
            Input, output & sensing
                  Touchscreen/multi-touch, physical or virtual keyboard, voice, camera,
                  microphone, speakers.
                  GPS, accelerometer, gyroscope, compass, fingerprint sensor.
            Connectivity & communication
                  Network access: cellular 4G/5G, Wi-Fi, Bluetooth, NFC;
                  Frequent planned or unplanned disconnections and short connection
                  periods.
            Security
                  High security risks; easily lost, stolen; exposed to unauthorized access.
講義第 11 頁 / Lecture slide 11
Mobile Device Platform
       A mobile operating system (MOS) is installed on client-side
      mobile devices.
      MOS provides a platform for app developers with various
      functions
           User interface
           Application execution
           Multitasking
           Storage and memory management
           Wireless networking
           Power management
           I/O control
           Etc.
      Dominant MOS platforms
           Android: ~75% global market share, over 3.5 billion active users
   Wei Lou @ Department ofiOS: ~25% market  Computing, Hong Kong Polytechnshare, approximately 1.3 billion iPhone usersic Univ.                                                                                                                        Slide  11
講義第 12 頁 / Lecture slide 12
MOS Platform: Android vs. iOS
    Android – Open and flexible
          Advantages
               Largest user base globally.
               Customization options; third-party apps from non-Google stores.
          Challenges
               Fragmentation: only ~10% of devices run the latest OS version.
               Longer quality assurance (QA) cycles, higher development costs.
    iOS – Controlled ecosystem
          Advantages
               Faster development cycles, easier QA (fewer device variants).
               Long-term support for iOS updates.
               Consistent user experience across devices.
                Users are more willing to pay for apps and subscriptions.
          Challenges
               Closed ecosystem: limited customization; no third-party app stores.
               macOS/Xcode and Apple hardware required for development.
講義第 13 頁 / Lecture slide 13
Smart Client Application
     Smart client applications run at the client side
           Provide a rich and customized user interface to the end user.
           Execute client-side application logic and messaging
                 Client-side application logic dictates how the client application acts.
                      Where the application gets the data (from local storage or server).
                      How the data is presented, processed, and stored on the device.
                      What set of data is sent back to the enterprise system for data consistency.
                 Client-side application logic can reduce the transmission overhead.
           Have persistent data storage to store data locally to provide offline
           data access
                 Persistent data storage is a key component of a smart client   application.
                      Store the application’s data locally on the device.
                      Provide fast, reliable access to the data without wireless connectivity.
           Communicate to the server via a wireless connection.
講義第 14 頁 / Lecture slide 14
Wireless Gateway
    What is a wireless gateway?
          A wireless gateway is a device or software component that connects
          mobile devices to the wired Internet or other networks.
          It serves as the bridge between the wireless and wired worlds.
          It allows a mobile user to access Internet service and data through the
          same entry.
    Main components
          Protocol gateway/emulation engine: Encapsulation/de-encapsulation of
          data.
          Administration and maintenance module.
          User cache: Stores user subscription info, access lists, QoS policies.
          Queuing engine: Manages data buffers for transmission.
          Data storage: Persistent storage for configuration and logs.
講義第 15 頁 / Lecture slide 15
Wireless Gateway
     Key gateway functions
           Protocol conversion
                 Translate between different wireless/wired Internet protocols.
                 e.g., wireless protocol ↔ IP, WAP ↔ HTTP, HTML ↔ WML etc.
           State management
                 Track connection states of multiple user devices.
           Access control
                 Enforce bandwidth limits and QoS policies for mobile users.
           Optimize communication streams
                 Data compression and packaging for transport over wireless networks
           Routing
                 Direct data to the correct access point and user device.
           Push messages to wireless clients
           Enhance security
講義第 16 頁 / Lecture slide 16
Wireless Application Server
     What is a wireless application server?
          A server platform that hosts and delivers applications to mobile
          devices.
     Key functions
          Application hosting for content providers.
                Content adaptation: Format content for different device capabilities
                Support content download via Over-the-Air (OTA) protocol.
                      OTA distribution: Push content to devices over the air.
          Application management: Upload, version control, deployment.
          Traffic tracking and billing
                Monitor application  traffic usage and generate billing data.
          Security: Authentication, encryption, access control
          Scalability: Support for large numbers of concurrent users.
講義第 17 頁 / Lecture slide 17
Synchronization Sever
    Smart client applications need data synchronization.
    What is data synchronization?
          A procedure that keeps application data consistent between backend
          systems and mobile devices.
                Synchronize multiple copies of the same data across clients and the server.
          Data synchronization includes
                Backup from client devices to the server.
                Data updates to/from client devices.
                Propagation of data updates from the server to all client devices.
    Why need synchronization?
          Maintain data consistency across devices
                Users access the same data from multiple devices (phone, tablet, laptop);
                Mobile devices may be offline when changes are made;
                Data changes on one device must be reflected on others;
                Need for conflict detection and resolution.
講義第 18 頁 / Lecture slide 18
Synchronization Sever
    Data synchronization is mostly executed on the
    synchronization server.
    The client application also knows certain synchronization
    information:
          Sync server location.
          Data to be synchronized.
    Main components
          Protocol manager module
                Handles data preprocessing for synchronization
                Uses Open Mobile Alliance (OMA) DS / SyncML standards
          Synchronization manager module
                Determines sync policies
                Detects data changes and conflicts
          Database manager module
                Extracts and stores synchronization data
講義第 19 頁 / Lecture slide 19
Synchronization Sever
     Key functions
           Integration with mobile devices.
                 Receive data from client application
                 Support disconnected operations
                 Optimize data transferred over wireless
                 Support multiple data formats
                 Ensure both client and server can decipher transferred data
           Synchronization logic
                 Determine how to manipulate data
                      e.g., data subsetting, data transformation, data compression, etc
                 Detect and resolve data conflicts
                      Simple: apply updates to data storage; server wins, client wins
                      Advanced: complex updates to detect and resolve conflicts
           Integration with the back-end data source
                 Uses standard DBMS to access back-end data sources
                 Keeps back-end and mobile data aligned
講義第 20 頁 / Lecture slide 20
Synchronization Sever
     Sync types
            Two-way sync: Full bidirectional synchronization
            One-way sync: Client updates server, or vice versa
     Features
            Scalability
                   Sync time increases smoothly with data volume and client count
            Transmission granularity
                   Field-level transmission outperforms record-level for partial updates
講義第 21 頁 / Lecture slide 21
Messaging Server
     What is a messaging server?
           A computing system configured to generate and transmit notifications
           to mobile client devices
     Components
           Storage backends: Memory, file system, or database
           Message queue: For temporary message storage
           Push notification connectors:
                Firebase Cloud Messaging (FCM): For Android push notifications
                Apple Push Notification Service (APNS): For iOS push notifications
     Key functions
           Sending push notifications, emails, SMS
           Managing message queues
           Handling delivery retries for offline devices
           Tracking delivery status
講義第 22 頁 / Lecture slide 22
Messaging Server
     Features
           Push vs. poll
                  Push: The message server pushes the message to the client.
                       Suitable for real-time delivery without client polling
                  Poll: The client polls the server for messages.
                       Initiated by the client; adapt for intermitted connections
                       Can be periodic or ad hoc
           Delivery guarantees
                  Offline messages are stored temporarily in a message queue
                  Delivery retries with exponential backoff
           Message server management
                  Multiple message servers handle traffic with push services
           Various message types
                  Notifications, alerts, transaction confirmations, chat messages
講義第 23 頁 / Lecture slide 23
Outline
        Wireless mobile Internet architecture
        Key components
        Proxy services (Transcoding, Caching)
        Mobile data management
講義第 24 頁 / Lecture slide 24
Mobile Internet Proxy Services
      The proxy problem: Why do we need proxies for mobile?
           Mobile devices have diverse capabilities:
                 Varying screen sizes and resolutions
                 Different bandwidth availability
                 Different processing power and memory
           Servers cannot handle this diversity alone
      Solution
           Add intermediate proxies that adapt content to client capabilities.
      Proxies are essential for bridging the gap between servers
      and heterogeneous mobile devices.
           Significantly improve client-side applications’ performance
講義第 25 頁 / Lecture slide 25
Proxy Services:
Transcoding and Caching
    Transcoding: Transform content to match device capabilities
          What is transcoded?
                Images: Resized, compressed, format changed
                Video: Bitrate adjusted, resolution reduced
                HTML: Simplified for small screens
          Transcoding decision-making
                Proxy decides how to transcode the content
                     E.g., desktop page or mobile page, via WiFi or cellular network
    Caching: Storing frequently accessed content closer to users
          Caching decision-making
                Proxy decides to use content locally or fetch content from      the server
          Benefits for mobile
                Reduces latency for accessing popular objects locally
                Saves bandwidth on expensive cellular connections
                Improves user experience for repeated visits
講義第 26 頁 / Lecture slide 26
Outline
        Wireless mobile Internet architecture
        Key components
        Proxy services (Transcoding, Caching)
        Mobile data management
講義第 27 頁 / Lecture slide 27
Mobile Data Access
      Why mobile data access?
            With increasing wireless connectivity and the popularity of portable devices
            popularity, mobile users are enabled to access and share online data.
            Mobile users can carry extracts of enterprise databases with them to have
            continuous access.
      Characteristics of mobile data access
            The bandwidth of the wireless channel is asymmetric
                  The BW of downlink >> the BW of uplink
                         Sending data from the server to clients is much faster than vice versa
            The energy consumption is an important issue
                  The mobile device in active mode consumes more energy than in sleep mode; the
                  difference is by orders of magnitude
            The wireless connection is unreliable
                  Frequent disconnections can occur; it can make data inconsistent during an update
                  transaction
            The number of mobile devices is much larger compared to the number of
            servers
講義第 28 頁 / Lecture slide 28
Approaches to Mobile Data Access
      Approaches
             Pull-based mechanisms (on -demand mode)
                   Client actively requests data from the server
             Push-based mechanisms (publish -subscribe mode)
                   Client subscribes to the service and the server actively pushes data to the
                   client
             Hybrid mechanisms (hybrid mode)
                   Two channels between devices and server - front channel for push
                   and back channel for pull
講義第 29 頁 / Lecture slide 29
Pull-  based Mechanisms
       Relevant data is sent to the user only when the user asks
       for it
             No unsolicited or irrelevant data will arrive at the device
       The best option when the server has very little contention
       and can respond to many device requests within expected
       time intervals
             i.e., music album server, ringtones server, video  clips server, or
             bank account activity server
                                                 client                                   client
                              client
                         client                            server                          client
                                         client                                    client
講義第 30 頁 / Lecture slide 30
Pull-  based Mechanisms
       Features
             Bandwidth used for the uplink channel depends upon the number of
             pull requests
                    Assume one uplink bandwidth of 100kbps and the server channel
                    capacity of 2Mbps; only 20 pull requests can be accepted by the server
                    If the number of pull requests is larger, the uplink bandwidth has to be
                    reduced to 50kbps or 25kbps
             Pull cannot scale beyond the capacity of the server or the network
                    Define a pull threshold to limit the number of pull requests in a given
                    period of time
講義第 31 頁 / Lecture slide 31
Push-        based Mechanisms
       Server decides what data is appropriate to be sent and how
       the data is to be sent
             Server selects a structure of data items to be pushed
                  Use an adaptable mechanism to push data items uniformly or non-
                  uniformly according to their relative importance
             Server determines time intervals to push the selected data
                  For devices that were previously disconnected, pushing data at periodic
                  intervals provides them a chance to get the data when it is pushed again
             Server allocates bandwidth in  the downlink for  pushing data
                  Higher bandwidth is allocated to data items with a larger number of
                  subscribers or higher access probabilities
                                                client                         client
                               client                    server                   client
                                         client                               client
講義第 32 頁 / Lecture slide 32
Push-        based Mechanisms
       Suitable when commonly interested data is transmitted to a
       large number of clients
             i.e., advertisers or generators of traffic congestion, weather reports,
             stock quotes, and news reports
       Features
             The server saves bandwidth and is prevented from being
             overwhelmed by client requests
             Push operation is scalable; it does not depend on the number of
             clients
講義第 33 頁 / Lecture slide 33
Hybrid Mechanisms
        Two channels between devices and server - front
       channel for push and back channel for pull
        Bandwidth is shared and adapted between the two channels
           Bandwidths adapted in downlink and uplink channels depend on
           the number of active devices receiving data from the server and
           the number of devices requesting data pulls from the server
                                               client
                             client                                                     client
                         client                           server
                                                                                       client
                                        client
                                                                                client
講義第 34 頁 / Lecture slide 34
Disconnected Operations
    A client application may work in a mobile environment that
    suffers from weak or intermittent connectivity.
          Weak/intermittent wireless links subject to disturbances and failures
          Users in areas with no coverage (remote areas, underground)
          Wireless connectivity may be unavailable (failure, congestion, roaming)
    What is a disconnected operation?
          Disconnected operation
               A mode of operation that enables a client to continue accessing critical data
               maintained at the server during temporary interruption of network
               connection
          Weakly connected operation
               Network condition is poor (radio signal is at a lower level, connectivity is
               intermittent, channel noise)
          Disconnected operation is the extreme of weakly connected operation.
          Disconnection can be involuntary or voluntary.
講義第 35 頁 / Lecture slide 35
Disconnected Operations
    Disconnected operation is essential for real-world
    mobile computing apps
    Why need support for disconnected operations?
          Client apps can provide data availability under mobile
          circumstances
               User mobility
               Unpredictable network conditions
          Client’s choice:
               Extends battery life by avoiding wireless transmission and reception
               Reduces network charges
               Allows radio silence - a vital capability in military applications
講義第 36 頁 / Lecture slide 36
Support Disconnected Operations
      Objectives
           Ensure data availability even under disconnection
           Make a trade-off between data consistency and data
           availability
                 Store the most probable data item locally for best future use, given
                 a limited amount of storage and potential  changes    in data item
                 values
      Solutions
           Provide replicated copies at several places to achieve data
           availability
                 Caching
                 Prefetching
                 Hoarding
講義第 37 頁 / Lecture slide 37
Support Disconnected Operations
     Caching refers to the maintenance of a copy of data item
     previously obtained from the server in client storage for
     potential future use.
          E.g., cache data in memory; cache remote data at local disk.
          Normally, caching is done on an on-demand basis. Client requests a
          needed item and keeps a local copy.
     If there is no immediate need for an item but client still
     requests for it and keeps a copy for future need, this is
     called pre-fetching.
          Prefetching occurs on an anticipatory basis.
     If prefetching is done in anticipation of future disconnection,
     this is called hoarding.
     Consistency of cached data item needs to be ensured.
          This is hard for hoarding, since the client is disconnected and cannot
          receive any notification about the potential inconsistency.
講義第 38 頁 / Lecture slide 38
Cache Invalidation
     What is cache invalidation?
            The value of the data may have changed since caching.
           Cache invalidation ensures that copies of a data item are identical at
           the server and in     the device cache.
     Traditional invalidation
           Server sends an invalidation msg to client to revoke the privilege to
           access a cached item.
           Client removes the invalidated item and replies with an invalidation
           ACK msg.
     The problem of invalidation in mobile environments:
           Server can broadcast an invalidation msg to many clients, but they
           may be facing different states (some may be sleeping).
           Server may not know the identity of some clients.
           Client may miss some invalidation reports.
           Client may be disconnected.
講義第 39 頁 / Lecture slide 39
Cache Invalidation
      How can the server ensure that invalidation is done
      properly?
             The server needs to decide
                  When to send invalidation reports: synchronous or asynchronous?
                  To whom are the invalidation reports sent: stateful or stateless?
                  How to send the invalidation reports: pulling or pushing?
                  What to send?
                      Invalidation: only which items were updated
                      Propagation: the values of updated items are sent
講義第 40 頁 / Lecture slide 40
Cache Invalidation
    Two ways to send reports:
          Synchronous: broadcast invalidation reports periodically to
          clients.
               A client needs to wait and listen for reports periodically.
               If there is a query, the client needs to wait till the report comes to
               ensure that the cached item can be used.
               Alternatively, the client can initiate a pull request to the server.
          Asynchronous: broadcast an invalidation report to clients
          when there is a change in the data item value.
               a pull from the server.The client listens for the next report to answer a query or initiates
                                                      update             update               invalid
                              valid
                                                query                        query
講義第 41 頁 / Lecture slide 41
Cache Invalidation
    Cache state maintenance
          Stateful:
                 The server maintains information about its clients, e.g., the
                 contents of their cache and when it was last validated.
                 The server sends the invalidation reports to affected clients.
          Stateless:
                 The server does not maintain information about its clients.
                 The server broadcasts the invalidation to everyone.
講義第 42 頁 / Lecture slide 42
Cache Invalidation
     Cache consistency maintenance
           Pulling mechanism (client-initiated case):
                 The client checks with the server about the state of the data item:
                 valid/invalid (expired, modified), etc.
           Pushing mechanism (server-initiated case):
                 When a cached data item becomes invalid and thus unusable, the
                 server sends invalidation reports, either synchronously or
                 asynchronously.
講義第 43 頁 / Lecture slide 43
Pulling Methods
      Each cached data item is checked whenever required.
             If the data copy becomes invalid on the device or has been modified
            on the server, the device requests the modified data for replacement.
      Time-to-live mechanism
            Each cached item is assigned a TTL (time-to-live).
            The TTL assignment is adaptive (adjustable) to previous update
            intervals of that item.
            After the TTL expires, the client device polls for an invalid or modified
            state.
            If an invalid or modified state is found, then the device requests the
            modified data from the server to replace the previous one.
            If TTL is set to 0, the TTL mechanism is equivalent to the polling
            mechanism.
講義第 44 頁 / Lecture slide 44
Pushing Methods
        Pushing methods
               Stateless asynchronous
               Stateless synchronous
               Stateful asynchronous
               Stateful synchronous
講義第 45 頁 / Lecture slide 45
Stateless Asynchronous
      How it works
           The server does not maintain client cache states and advertises the
           invalidation reports when the cache state changes.
           On receiving an invalidation report, the client requests the new data item.
      Advantages
           Guaranteed synchronization: Even  clients that missed an earlier report can
           detect the miss and request it.
           Bounded waiting time: Clients know the maximum delay before the next
           invalidation arrives.
           Cache consistency: The clients send requests for invalid data promptly,
           keeping cache consistency through regular exchanges.
           Energy efficiency: The client can enter power-saving mode and wake only
           during scheduled times.
      Disadvantages
           Unnecessary delivery of data invalidation reports: Every client device  gets an
           invalidation report, whether that client requires that copy or not.
           Data consistency issue: The client presumes that as long as there is no
           invalidation report received, the cached copy is valid for use.
講義第 46 頁 / Lecture slide 46
Stateless Synchronous
      How it works
            The server does not maintain client  cache states and periodically advertises
            invalidation reports.
            The client requests the data item when receiving the invalidation report.
            If no invalidation report is received by the end of the period, the client
            requests the report.
      Advantages
            Cache consistency: The client receives periodic information about the
            invalidity of the caches, keeping     cache  consistency through periodic
            exchanges.
            Low server state overhead: The server does not maintain cache state for
            every client.
      Disadvantages
            Unnecessary delivery of data invalidation reports: every client gets an
            invalidation report periodically, irrespective of whether it has a copy of the
            invalidated data or not.
            Data consistency issue: During the period between two invalidation reports,
            the client may have inconsistent data.
講義第 47 頁 / Lecture slide 47
Stateful Asynchronous
      How it works
            The server keeps track of device cache states
            The server transmits an invalidation report to concerned devices when an
            update occurs.
            The client requests new data when receiving the invalidation report and sends
            its new state after caching the new record from the server.
      Advantages
            Bandwidth efficient: Only affected clients receive  the invalidation reports and
            other devices are not flooded with irrelevant reports.
            Low client overhead: Clients do not need to listen to periodic invalidation
            reports, saving energy and processing.
            Immediate consistency for connected clients: Updates trigger invalidation right
            away, minimizing staleness for online clients.
      Disadvantages
            Data consistency issue: The client presumes that, as long as there is no
            invalidation report, the copy is valid for use. When a link fails, the client uses
            invalidated data.
            High server state overhead: The server must maintain cache state for every
     Wei Lou @ Department ofclient, causing a scalability bottleneck. Computing, Hong Kong Polytechnic Univ.                                                                                                                        Slide  4747
講義第 48 頁 / Lecture slide 48
Stateful Synchronous
      How it works
            The server maintains device cache states and periodically transmits an
            invalidation report to the concerned devices.
            If no report is received by the end of the period, the client requests the report.
            The client requests new data when receiving the invalidation report and sends
            its new state after caching the new data.
      Advantages
            Guaranteed consistency: The server  can synchronize the client in time when
            invalid data gets modified.
            Reduced client overhead: Avoid sending unnecessary invalidation reports to
            clients that do not hold the data.
      Disadvantages
            High server complexity and bandwidth: The server maintains state for every
            client; the server  requires high bandwidth to send periodic reports to each
            client.
            Periodic server overhead: Even when no data changes, the server still sends
            periodic reports (wasteful in a stable environment).
講義第 49 頁 / Lecture slide 49
Summary
    Architecture: Multi-tier system with specialized components for mobile
    support
          Thin client, thick client
    Mobile device platforms: iOS and Android dominate the MOS market, each
    with distinct characteristics
    Servers: Application, Sync, and Messaging servers handle different service
    needs.
    Proxy services: Transcoding and caching adapt content to device
    capabilities
    Mobile data management: Mobile data access mechanisms and
    disconnected operation mechanisms ensure data availability and
    consistency.