Today a mobile user expects immediate access to fresh, relevant data in the internet. Fresh data can be brought to users, for example, by real-time push notifications. Before an application can receive notifications, the user has to subscribe to information channels provided by a server (i.e. a connection is established between the user's device [i.e. a client] and the server); whenever new content is available on one of those channels, the server pushes that information out to the client. Real-time push notifications are a battery saving technology that allows instant updates without polling. Such a service may utilize data compression algorithm to reduce size of message that need to be delivered to user device.
However, the increasing use of internet services demands a high number of concurrent connections from the server. The high number of concurrent connections requires high resource usage in the server. Server memory is utilized for establishing and maintaining connection of a user with the server. Generally the server does not terminate a connection after response data has been served to a user. The server leaves the connection open so that if an event is received by the server or service, it can be sent immediately to one or multiple users; otherwise, the data would have to be queued until the client's next request is received. This high memory utilization limits the number of active users served by a single server. Each user connection may require 300 kB or more memory. The memory is required for user authentication, for example, through ZLIB compression algorithm (i.e. 300 KB memory) and for real-time push notification service, for example through ZLIB and/or Transport Layer Security (TLS) stream compression.
The present application relates generally to memory usage optimization of a server, for example, a real-time push notification server, a video or audio streaming server or any other suitable server that uses persistent connections. Now there has been invented an improved method and technical equipment implementing the method. Various aspects of the invention include a method, an apparatus, and a computer readable medium comprising a computer program stored therein, which are characterized by what is stated in the independent claims. Various embodiments of the invention are disclosed in the dependent claims.
According to a first aspect of the invention, there is provided a method, comprising establishing a connection between a client device and a server suitable to have a plurality of connections with a plurality of client devices, utilizing a server memory of the server for establishing and maintaining connection of the client device with the server by connection content data and data structures, storing the connection content data and data structures to a disk from the server memory when the connection shifts to an idle state, and removing the connection data and data structure from the server memory.
According to an embodiment, the server is a real-time push notification server. According to an embodiment, the method further comprises restoring the connection data and data structure to the server memory when server is indicated about a real-time push notification to be delivered to the client device. According to an embodiment, the server is a video or audio streaming server. According to an embodiment, the connection content data and data structures are stored to the disk after the connection has been in the idle state for a predetermined time. According to an embodiment, the connection content data and data structures are stored to the disk in the idle state if the server has more than a predetermined number of concurrent connections with client devices. According to an embodiment, the connection content data and data structures are stored to the disk in every second or third idle state. According to an embodiment, the connection content data and data structures are stored to the disk for idle state if the server memory capacity is running low.
According to a second aspect of the invention, there is provided an apparatus comprising at least one processor, memory including computer program code, the memory and the computer program code configured to, with the at least one processor, cause the apparatus to perform at least the following: establish a connection between a client device and a server suitable to have a plurality of connections with a plurality of client devices, utilize a server memory of the server for establishing and maintaining connection of the client device with the server by connection content data and data structures, store the connection content data and data structures to a disk from the server memory when the connection shifts to an idle state, and remove the connection data and data structure from the server memory.
According to an embodiment, the server is a real-time push notification server. According to an embodiment, the computer program code configured to, when executed on at least one processor, further cause the apparatus to restore the connection data and data structure to the server memory when server is indicated about a real-time push notification to be delivered to the client device. According to an embodiment, the server is a video or audio streaming server. According to an embodiment, the connection content data and data structures are stored to the disk after the connection has been in the idle state for a predetermined time. According to an embodiment, the connection content data and data structures are stored to the disk in the idle state if the server has more than a predetermined number of concurrent connections with client devices. According to an embodiment, the connection content data and data structures are stored to the disk in every second or third idle state. According to an embodiment, the connection content data and data structures are stored to the disk for idle state if the server memory capacity is running low.
According to a third aspect of the invention, there is provided a computer program product embodied on a non-transitory computer readable medium, comprising computer program code configured to, when executed on at least one processor, cause an apparatus to establish a connection between a client device and a suitable to have a plurality of connections with a plurality of client devices, utilize a server memory of the server for establishing and maintaining connection of the client device with the server by connection content data and data structures, store the connection content data and data structures to a disk from the server memory when the connection shifts to an idle state, and remove the connection data and data structure from the server memory.
According to an embodiment, the server is a real-time push notification server. According to an embodiment, the computer program code configured to, when executed on at least one processor, further cause the apparatus to restore the connection data and data structure to the server memory when server is indicated about a real-time push notification to be delivered to the client device.
According to a fourth aspect of the invention, there is provided an apparatus, comprising means for establishing a connection between a client device and a server suitable to have a plurality of connections with a plurality of client devices, means for utilizing a server memory of the server for establishing and maintaining connection of the client device with the server by connection content data and data structures, means for storing the connection content data and data structures to a disk from the server memory when the connection shifts to an idle state and means for removing the connection data and data structure from the server memory.
According to an embodiment, the server is a real-time push notification server. According to an embodiment, the apparatus further comprises means for restoring the connection data and data structure to the server memory when server is indicated about a real-time push notification to be delivered to the client device. According to an embodiment, the server is a video or audio streaming server. According to an embodiment, the connection content data and data structures are stored to the disk after the connection has been in the idle state for a predetermined time. According to an embodiment, the connection content data and data structures are stored to the disk in the idle state if the server has more than a predetermined number of concurrent connections with client devices. According to an embodiment, the connection content data and data structures are stored to the disk in every second or third idle state. According to an embodiment, the connection content data and data structures are stored to the disk for idle state if the server memory capacity is running low.
In the following, various embodiments of the invention will be described in more detail with reference to the appended drawings, in which
Real-time push notifications relating to information preferences expressed in advance for a push notification server are a convenient way of keeping mobile users in touch with fresh and relevant information, for example, in the internet. Server memory is utilized for establishing and maintaining connection of the client with the push notification server for real-time push notifications. The server memory is required for user authentication, for example, through ZLIB compression algorithm and for real-time push notification service, for example through ZLIB and/or Transport Layer Security (TLS) stream compression. Each connection between the client and the push notification server may require 300 KB or more server memory.
This high server memory utilization may limit the number of active users served by a single push notification server. In order to enable real-time push notifications to be delivered to everyone who wants to receive them—regardless of which mobile, desktop or media device they happen to be using—the push notification server memory utilization should be optimized so that the memory utilization does not so intensely limit the number of active users served by a single push notification server.
Each time when the connection between a client and a push notification server switches to an idle state i.e. to a state, where no notification is needed to be delivered to the client, the push notification server moves connection information comprising data and data structures, for example, internal data structure required for ZLIB compression or other compression method, state of user/client session, user/client specific information or any other information that is needed to provide service to the user/client, to a disk e.g. a non-volatile, persistent memory and destroys them from the server memory location e.g. RAM, thereby freeing the server memory for other active connections to overcome the memory limit of the push notification server. For any real-time push notification delivery from the server to the client in future, the server restores the client's connection information i.e. the data and data structures from the disk back to the server memory.
Thus, by moving the connection information to the disk for the idle state worth, a single push notification server can serve an increasing number of active client connections on the push notification server. This server memory capacity discharging for the idle state may be called a server memory optimizing method.
In the following, several embodiments of the invention will be described in the context of an apparatus, for example, a push notification server. The server is suitable to transmit real-time push notifications to a client i.e. a client device comprising an internet-access i.e. means for connecting the device to the computer networks, such as the world wide web (WWW) by mobile, wired or wireless connection, for example, WAN or WLAN. The push notification server is a system, hardware and software, that may respond to requests across a computer network to provide, or help to provide, a network service. Servers can be run on a dedicated computer, which may be referred to by a term “the server”, but many networked computers are capable of hosting servers. In many cases a computer can provide several services and have several servers running. Servers may operate within a client-server architecture; servers are computer programs running to serve the requests of other programs, the clients. Thus, the server performs some task on behalf of clients. The clients either run on the same computer, or they connect through the computer network. The device i.e. a mobile client may be, for example, a, mobile phone, a mobile computer, a mobile collaboration device, a mobile internet device, a smart phone, a tablet computer, a tablet personal computer (PC), a personal digital assistant, a handheld game console, a portable media player, a digital video camera (DVC or digital camcorder), a pager, or a personal navigation device (PND).
A service's application server 150 generates notifications. Generated notifications are sent to the notification service 140. When the notification service 140 receives at least one notification that is specified by the notification ID, the server 130 restores the connection information (data and data structures) relating to that notification ID from the disk 170 to the memory 160. Then the notification service 140 delivers received notifications to the client device 110 relating to that notification ID over the connection established between the client 110 and the notification service 140. Once a notification is received on the client device 110, it will be delivered to the appropriate application 120 through the Notification Client API. Delivery can occur regardless of the current state of the target application 120, whether it is active, in the background, or even if it is not running, in which case it can be woken up and launched. Then the client device 110 may alert the user of the client device 110 by some means available on the device, i.e. sound, pop-up window, by opening the application etc. Application 120 receiving notifications may be, for example, a navigation application that alerts mobile device users to changes in optimal routes and even updates the weather conditions for their destinations or a music store that suggests music play lists based on the user's social network favorites or a news application that sends the latest headlines as soon as they are available.
Before storing the connection data and data structures to disk, the server may, for example, wait for a predetermined time or the server may move the data to the disk only in every other or third idle state or when it notices that the server memory capacity is running low or if a number of client connections exceeds a predetermined number of concurrent client connections, or if an estimated next notification time is higher than the predetermined time. The estimated notification time may be estimated by machine learning giving an estimated value for the idle time by analyzing the timestamp of notification delivered from different services subscribed by the mobile client (user) and/or on the basis of other features such as user amount, system load, system usage pattern etc. In addition it is possible that the server does not move/store the connection data and data structures to the disk at all or that it mixes above mentioned methods.
It is also possible that a push notification server restores from a disk only a part of the data relating to a notification ID and/or that a push notification server restores from a disk only a part of the data that is stored to the disk, wherein that restored part is data that is necessary for sending a real-time push notification to a client.
The various embodiments of the invention can be implemented with the help of computer program code that resides in a memory and causes the relevant apparatuses to carry out the invention. For example, a device may comprise circuitry and electronics for handling, receiving and transmitting data, computer program code in a memory, and a processor that, when running the computer program code, causes the device to carry out the features of an embodiment. Yet further, a network device like a server may comprise circuitry and electronics for handling, receiving and transmitting data, computer program code in a memory, and a processor that, when running the computer program code, causes the network device to carry out the features of an embodiment.
It is obvious that the present invention is not limited solely to the above-presented embodiments, but it can be modified within the scope of the appended claims.
Filing Document | Filing Date | Country | Kind |
---|---|---|---|
PCT/FI2013/050567 | 5/24/2013 | WO | 00 |