Professional Documents
Culture Documents
Cloudy Knapsack Problems: An Optimization Model For Distributed Cloud-Assisted Systems
Cloudy Knapsack Problems: An Optimization Model For Distributed Cloud-Assisted Systems
c
978-1-4799-6201-3/14/$31.00
2014 IEEE
14-th IEEE International Conference on Peer-to-Peer Computing
Budget constraints on cloud usage: For a non- Different mechanisms like periodic broadcast, polling or gossip
commercial peer-to-peer application with a donation-based combined with prediction techniques can be used for view
model, the budget available for cloud usage can be severely synchronization ([2], [9]). Generally, obtaining a more accurate
limited. Hence a subset of the candidate tasks can only be view will incur more overhead in terms of network and device
offloaded to the cloud. Large user base and high processing resource usage. Different mechanisms can be abstracted based
required per task can also lead to budget constraints in even on the distribution of error in the global views they provide.
some commercial mobile apps. WhatsApp, a messaging ser-
vice with modest processing requirements, requires a 11000 A. Formal decision making problem
core cluster in its cloud backend1 . This is because of its large
active user base consisting of hundreds of millions of users. System model: Each task(j) generated can be associ-
A compute-intensive app like mOCR of similar popularity can ated with a weight(wj ) corresponding to the cloud resources
require millions of cores if all its tasks are offloaded to the consumed by it and a value(πj ) corresponding to the user
cloud. Hence the offloading decision making for such an app experience improved if the task is offloaded. These weights
will need to consider the budget constraints also. and values can be dynamically assigned after the task is
generated based on the task characteristics and client context.
Challenges: First, we discuss the feasibility of a cloud- For example, in the case of mOCR, the value assigned to a task
based centralized scheduler to select tasks to be offloaded. can be a function of the task’s estimated energy consumption
For applications with hundreds of millions of users, the cu- and the current battery level. In case of peer-to-peer applica-
mulative task generation rate can be very high. This issue is tions, tasks which remain unprocessed even after assistance
compounded in case of multimedia applications like mOCR from other peers(e.g., missing frames in Clive-P) will only
where the task generation rate per device can be of the order be considered for offloading. Maximum budget(B) can be
of frames per second. This can lead to scalability bottlenecks defined as a constant for a fixed time period(e.g., donation-
for a centralized scheduler. Further, for many applications, based model) or relative to the total number of tasks(e.g., a
most of the tasks(say 90%) can be processed at the client commercial app with estimated revenue per task). In the latter
side(peer or mobile device) itself. In case of low latency tasks case, budget can be defined in terms of β = N B
where β is
like OCR or video streaming, the additional latency of 100- application-specific and N is the total number of tasks.
150ms involved in contacting the remote scheduler for each
task will increase the average latency significantly. Next, we The above model assumes a task-level monetary price for
discuss the challenges for a client-side scheduler to make the cloud usage. This directly corresponds to the cases where the
offloading decisions. The potential benefit from offloading a app provider uses a higher level service like Storage-as-a-
task can depend significantly on the context which can vary Service(as in Clive-P) or Platform-as-a-Service(PaaS) from the
significantly. In the case of mOCR, the benefit from offloading cloud. To model a lower level service like Infrastructure-as-
tasks increases if the phone is having low battery level. The a-Service(IaaS), additional factors like delay in starting and
cost involved in processing different images in the cloud can stopping instances may have to be considered.
also vary drastically. In the case of Cloud-P, the benefit from Cloudy knapsack problems: The goal of selecting items
downloading a video frame from cloud improves if many which maximize the overall value within the budget constraints
recent preceding frames were not rendered to the user. The can be expressed as:
overall task rate can also vary drastically at times during PN PN
interest spikes. Because of the importance of context and the Maximize j=1 πj xj subject to j=1 wj xj ≤ B, xj ∈
variability in the task rates, decision-making by individual {0, 1}
client schedulers while maximizing overall value addition is
challenging. where xj is an indicator variable denoting whether task
j is offloaded to cloud. If a central scheduler was feasible
for decision making, this optimization could be modelled
III. D ISTRIBUTED DECISION MAKING WITH PARTIAL as an online knapsack problem([5], [11]). Each task(j) with
VIEW corresponding weight(wj ) and value(πj ) will correspond to
Since a central scheduler with global view is not feasible, items to be considered for filling in a knapsack with maximum
the offloading decision of each task has to be made in a capacity B. Decision of each task(item) has to be made without
distributed setting. Decisions could be made either at the knowledge of the future sequence of tasks(items). Deciding
clients or using a hierarchical scheme. In both cases, only an to process a task in the cloud will correspond to putting
inexact view of the current global status will be available at corresponding item in the knapsack.
decision-making time. The global status when deciding on a The online knapsack problems assume that an exact view
task will include knowledge of the amount of budget consumed of all past events will be known while deciding on an item.
till now, total value added till now and total number of items The solutions can use the up-to-date global view to improve
considered till now. their performance. Deeparnab et al.[11] proposes an almost
The degree of inexactness of the global view(while decid- optimal algorithm for a particular online knapsack problem
ing on a task) will depend on the particular view synchroniza- setting. In the algorithm(ONLINE-KP-THRESHOLD), an item
π
tion mechanism used by the application as well as the scale. j is included in the knapsack if wjj ≥ Ψ(zj ) where Ψ is a
function on the fraction of knapsack filled when item j is
1 https://raw.githubusercontent.com/reedr/reedr/master/slides/efsf2014- considered(zj ). Such solutions are not possible when an up-
whatsapp-scaling.pdf Accessed: May 2014 to-date global view(here, that of zj ) is not available.
2
14-th IEEE International Conference on Peer-to-Peer Computing
5
To address above issue, we identify a new class of problems x 10
called cloudy knapsack problems. The problem setting is 8.4
3
14-th IEEE International Conference on Peer-to-Peer Computing
Ψ(z) ≡ (U e/L)z (L/e) Hence, algorithm A will attempt to put all items till the
knapsack is filled upto z̄. If z̄ > Z, then all the items can
When the j th item arrives, if item can be fitted in knapsack,
π be put into the knapsack without exceeding its capacity. Thus,
put item j iff wjj ≥ Ψ(Y (zj )).
algorithm A will perform as good as the optimal algorithm
We prove an upper bound of the competitive ratio of the and the claim in the theorem will be trivially satisfied. We
algorithm in the cloudy setting. now consider cases where z̄ ≤ Z.
By partitioning the input sequence into those items which
Theorem 1. For any input sequence σ, if OP T (σ) is the
appear before z̄ fraction is filled and afterwards, we can express
maximum achievable value(obtained by an optimal offline
P as
algorithm) and A(σ) is the value obtained by ONLINE-KP-
THRESHOLD-rz , then,
X X
P = πj + πj (10)
OP T (σ) U
U e 2rz T T
A(σ) ≤ ln L + 1
j∈S S ∗ ∧zj ≤z̄ j∈S S ∗ ∧zj >z̄
L
π
Proof: Let Z denote the fraction of the knapsack filled Since ∀j : L ≤ wjj , πj ≥ Lwj . Also for items in S, from
after execution of ONLINE-KP-THRESHOLD-rz (henceforth eq(8), πj ≥ Ψ(Y (zj ))wj . Using these inequalities in eq(10),
denoted by algorithm A). Let S and S ∗ denote the set of we get
items picked by the Algorithm A(selected by A and fitted in X X
knapsack) and the optimal offline algorithm (OP T ) respec- P ≥ P1 ≡ Lwj + Ψ(Y (zj ))wj
T T
tively. Let W = w(S ∩ S ∗ ) and P = π(S ∩ S ∗ ) denote the j∈S S ∗ ∧zj ≤z̄ j∈S S ∗ ∧zj >z̄
total weight and profit of the common items picked by both (11)
algorithms. Similarly,
OP T (σ) = π(S ∗ ) π(S\S ∗ ) ≥ P2 ≡
X
Lwj +
X
Ψ(Y (zj ))wj
= π(S ∩ S ∗ ) + π(S ∗ \ S) j∈S\S ∗ ∧zj ≤z̄ j∈S\S ∗ ∧zj >z̄
= P + π(S ∗ \ S) (3) (12)
As P ≥ P1 , eq(7) can be modified as
Since Ψ(z) is a monotonically increasing function, using eq(1),
we get OP T (σ) P1 + Ψ(Z + rz )(B − W )
Ψ(Y (zj )) ≤ Ψ(zj + rz ) ≤ Ψ(Z + rz ) (4) ≤ (13)
A(σ) P1 + π(S \ S ∗ )
πj
For each item j not selected by algorithm A, its is less than
wj
Ψ(Y (zj )). For items(j) selected by algorithm A, but did not fit Considering eq(12), eq(13) can be modified as
w
in the knapsack, (wj +zj B) > B. i.e., zj > (1− Bj ). For these OP T (σ) P1 + Ψ(Z + rz )(B − W )
wj w
items, Ψ(zj + rz ) > Ψ(1 − B + rz ). As wj ≪ B, rz > Bj . ≤ (14)
πj A(σ) P1 + P2
Hence, Ψ(zj + rz ) > Ψ(1) = U ≥ wj . Combining both the
classes of items not picked by algorithm A, and considering From definition of Ψ(z), we get Ψ(z̄ − rz ) = L. As z̄ ≤ Z,
eq (4), we get ∀j ∈ (S ∗ \ S), we get z̄ − rz ≤ Z + rz and Ψ(z̄ − rz ) ≤ Ψ(Z + rz ). Hence,
πj
< Ψ(Z + rz ) (5) L ≤ Ψ(Z + rz ) (15)
wj
From eq(3) and eq(5), we get From equations (15) and (4), (11) can be modified as
OP T (σ) ≤ P + Ψ(Z + rz )w(S ∗ \ S) X
P1 ≤ Ψ(Z + rz ) wj
≤ P + Ψ(Z + rz )(B − W ) (6) T
j∈S S∗
∗
as w(S ) ≤ B. = Ψ(Z + rz )W (16)
Now, A(σ) = P + π(S \ S ∗ ). Using (6), we get
OP T (σ) P + Ψ(Z + rz )(B − W ) Using (16) in numerator of (14), we get
≤ (7)
A(σ) P + π(S \ S ∗ ) OP T (σ) Ψ(Z + rz )B
For each item j in S(picked by A), ≤ (17)
A(σ) P1 + P2
πj
≥ Ψ(Y (zj )) (8) From (11) and (12),
wj
πj
Since ∀j, L ≤ when Ψ(Y (zj )) ≤ L, algorithm A will
wj , P1 + P2 1 X X
attempt to put item j into the knapsack. In this case, from eq(1) = Lwj + Ψ(Y (zj ))wj
and because Ψ(z) is a monotonically increasing function, we B B
j∈S∧zj ≤z̄ j∈S∧zj >z̄
get Ψ(zj − rz ) ≤ L. Substituting the value for Ψ(z), we get
(zj −rz ) 1 X X
Ue L ≥ Lwj + Ψ(zj − rz )wj
. ≤ L B
L e j∈S∧zj ≤z̄ j∈S∧zj >z̄
1
X X
zj ≤ z̄ ≡ rz + (9) = L∆zj + Ψ(zj − rz )∆zj (18)
ln( ULe ) j∈S∧zj ≤z̄ j∈S∧zj >z̄
4
14-th IEEE International Conference on Peer-to-Peer Computing
where ∆zj ≡ zj+1 − zj = wj /B. As ∀j : wj ≪ B, ∆zj ≈ 0. The online knapsack problem has been studied by [5], [11]
Eq(18) becomes under different assumptions on input distribution, knowledge
Z z̄ Z Z about the number of items, range of weights, and values.
P1 + P2 Unlike our setting, these works do not restrict the view of
≥ L.dz + Ψ(zj − rz ).dz
B 0 z̄ the knapsack during decision making.
Z−rz ! Ue
L
= L rz + (19) V. C ONCLUSIONS AND SCOPE FOR FUTURE WORKS
eln( ULe )
Cloudy knapsack problems is an effective way to model the
Substituting (19) in (17) and simplifying, we get distributed optimization required for large scale cloud-assisted
U e 2rz applications with budget and context constraints. We illustrated
ln U
OP T (σ) L +1 L the effect of cloudiness in global view through simulations and
≤ (20)
A(σ) 1 + F (Z) theoretical results. Insight into the relationship between the
Lrz ln( ULe )( ULe )
rz cloudiness in global view and the value addition can also lead
where F (Z) = Ψ(Z) . Since F (Z) ≥ 0, to design of novel peer-to-peer view synchronization mecha-
2rz nisms suitable for cloud-assisted systems. Further variants can
OP T (σ) U Ue be defined with different distributions for the error like Normal
≤ ln +1 (21) distribution. Lower bounds and optimal algorithms for these
A(σ) L L
variants are open problems. Techniques to handle selfish peers
which try to maximize their private gain without considering
Thus algorithm ONLINE-KP-THRESHOLD-r the overall value addition in this setting is also an open area
U e 2rzz can of research.
achieve a competitive ratio of ln U
L + 1 L in the
CLOU DY KP/rz /∗ setting under the specific assumptions.
This is an upper bound for the competitive ratio of any optimal R EFERENCES
algorithm for the setting. The competitive ratio obtained is [1] C ALHEIROS , R., AND B UYYA , R. Cost-effective provisioning and
U e 2rz scheduling of deadline-constrained applications in hybrid clouds. In
L times the ratio for the algorithm[11] in a non-cloudy
Web Information Systems Engineering - WISE 2012, X. Wang, I. Cruz,
setting(ln( U
L ) + 1). The lower bound for competitive ratio of A. Delis, and G. Huang, Eds., vol. 7651 of Lecture Notes in Computer
any algorithm in a non-cloudy setting[11] is ln( U L ). Since
Science. Springer Berlin Heidelberg, 2012, pp. 171–184.
any solution to the cloudy version of the problem cannot [2] D EMERS , A., G REENE , D., H AUSER , C., I RISH , W., L ARSON , J.,
give a better lower bound, the currently known range of the S HENKER , S., S TURGIS , H., S WINEHART, D., AND T ERRY, D. Epi-
demic algorithms for replicated database maintenance. In Proceedings
competitiveh ratio of an optimal algorithm(cloudy setting) of the Sixth Annual ACM Symposium on Principles of Distributed
U e 2rz i
becomes ln( U L ), ln U
L + 1 L . Finding the exact Computing (New York, NY, USA, 1987), PODC ’87, ACM, pp. 1–12.
lower bound and an optimal algorithm which achieves the [3] J IN , X., AND K WOK , Y.-K. Cloud assisted p2p media streaming for
bandwidth constrained mobile subscribers. In Parallel and Distributed
same is an open problem. Systems (ICPADS), 2010 IEEE 16th International Conference on (Dec
2010), pp. 800–805.
IV. R ELATED WORKS [4] KOSTA , S., AUCINAS , A., H UI , P., M ORTIER , R., AND Z HANG , X.
Thinkair: Dynamic resource allocation and parallel execution in the
Works in mobile cloud computing consider several context cloud for mobile code offloading. In INFOCOM, 2012 Proceedings
parameters like device’s energy consumption, local execution IEEE (March 2012), pp. 945–953.
time, cost incurred for offloading, etc. to decide which portions [5] M ARCHETTI -S PACCAMELA , A., AND V ERCELLIS , C. Stochastic on-
of the app should be offloaded [4], [10]. However, many of line knapsack problems. Math. Program. 68, 1 (Jan. 1995), 73–104.
these works are restricted to single mobile users and therefore [6] M ONTRESOR , A., AND A BENI , L. Cloudy weather for p2p, with
may give suboptimal aggregate performance as the number a chance of gossip. In Peer-to-Peer Computing (P2P), 2011 IEEE
International Conference on (Aug 2011), pp. 250–259.
of clients becomes very large and the budget is constrained.
[7] PAYBERAH , A., K AVALIONAK , H., K UMARESAN , V., M ONTRESOR ,
Recent works [4], [10] incorporate budget constraints, but rely A., AND H ARIDI , S. Clive: Cloud-assisted p2p live streaming. In Peer-
on centralized scheduling and hence cannot scale to large to-Peer Computing (P2P), 2012 IEEE 12th International Conference on
number of users as in our setting. Some works [1] in cloud (Sept 2012), pp. 79–90.
bursting consider certain duration for spending the budget [8] S WEHA , R., I SHAKIAN , V., AND B ESTAVROS , A. Angels in the
as well as an elastic set of resources. But they also do not cloud: A peer-assisted bulk-synchronous content distribution service.
address huge volume of user requests and rely on centralized In Proceedings of the 2011 IEEE 4th International Conference on
Cloud Computing (Washington, DC, USA, 2011), CLOUD ’11, IEEE
scheduling. Computer Society, pp. 97–104.
In contrast, existing works in P2P with cloud assistance [9] VOULGARIS , S., G AVIDIA , D., AND S TEEN , M. Cyclon: Inexpensive
deal with large number of clients and focus on improving membership management for unstructured p2p overlays. Journal of
Network and Systems Management 13, 2 (2005), 197–217.
the aggregate system performance [8], [7], [6], [3]. However,
[10] W EN , Y., Z HANG , W., AND L UO , H. Energy-optimal mobile applica-
most of them do not constrain the cloud budget explicitly. tion execution: Taming resource-poor mobile devices with cloud clones.
CloudCast[6] constrains the cloud budget to be used for In INFOCOM, 2012 Proceedings IEEE (March 2012), pp. 2716–2720.
content dissemination application. However, the application [11] Z HOU , Y., C HAKRABARTY, D., AND L UKOSE , R. Budget constrained
does not have high task variability and does not target devices bidding in keyword auctions and online knapsack problems. In
with context concerns like battery level. Hence, context and Proceedings of the 17th International Conference on World Wide Web
task variability related issues are not addressed. (New York, NY, USA, 2008), WWW ’08, ACM, pp. 1243–1244.