ori thesis

Upload: ali-raza

Post on 05-Apr-2018

244 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/2/2019 Ori Thesis

    1/56

    Economic Oriented CPU Sharing

    System for the Internet

    A thesis submitted in partial fulfillmentof requirements for the degree of

    Master of Science in Computer Science

    by

    Ori Regev

    supervised by

    Prof. Noam Nisan

    Institute of Computer Science

    The Hebrew University of JerusalemJerusalem, Israel

    July, 1998

  • 8/2/2019 Ori Thesis

    2/56

    Abstract

    The POPCORN project provides an infrastructure for globally distributed

    computation over the whole Internet. It provides any programmer connected to

    the Internet with a single huge virtual parallel computer composed of all

    processors on the Internet which care to participate at any given moment.

    POPCORN provides a market-based mechanism of trade in CPU time to

    motivate processors to provide their CPU cycles for other peoples computations.

    Selling CPU time is as easy as visiting a certain web site with a Java-enabled

    browser. Buying CPU time is done by writing a parallel program using the

    POPCORN paradigm. A third entity in the POPCORN system is a market for

    CPU time, which is where buyers and sellers meet and trade. The POPCORN

    system may be visited and used on our web-site:http://www.cs.huji.ac.il/~popcorn.

    This paper concentrates on the POPCORN market. The market is a trusted

    intermediary that is responsible for matching buyers and sellers according to

    economic criteria. Our design emphasizes minimal communication requirements

    and minimal strategic considerations on the part of both buyers and sellers. We

    implemented several market mechanisms of the single-sided and double-sided

    auction types. We analyze the economic efficiency of these mechanisms using analytical and simulation methods. Our findings support the use of these

    mechanisms in the Internet environment.

  • 8/2/2019 Ori Thesis

    3/56

    Acknowledgments

    I would like to thanks Prof. Noam Nisan for his excellent guidance, for showing me how toextract the essence out of vague ideas, for many hints that helped more than he imagines,and for our talks that always turned out longer than I promised.

    Shmulik London, for excellent ideas and productive arguments.

    The members of my family, for listening to my "lectures" and for their feedback.

    Last, I thank Tali for invaluable advice and for bearing me and my long meetings with my PC.

  • 8/2/2019 Ori Thesis

    4/56

    Contents

    Economic Oriented CPU Sharing .......................................................................1

    System for the Internet..........................................................................................1

    Acknowledgments..................................................................................................3

    I would like to thanks Prof. Noam Nisan for his excellent guidance, forshowing me how to extract the essence out of vague ideas, for many hintsthat helped more than he imagines, and for our talks that always turned outlonger than I promised..........................................................................................3

    Shmulik London, for excellent ideas and productive arguments......................3

    The members of my family, for listening to my "lectures" and for theirfeedback..................................................................................................................3

    Last, I thank Tali for invaluable advice and for bearing me and my longmeetings with my PC.............................................................................................3

    Contents..................................................................................................................4

    Chapter 1 Introduction......................................................................................5

    Chapter 2 Towards an Analysis of the POPCORN Markets.......................12

    Chapter 3 Simulating the POPCORN Trade.................................................23

    Chapter 4 The Architecture of POPCORNs Economic Infrastructure ....29

    Chapter 5 Directions for Further Research...................................................36

    Appendix A Economic-Oriented Computational Systems .........................39

    Appendix B Proof of Lemma 1........................................................................46

    References.............................................................................................................50

  • 8/2/2019 Ori Thesis

    5/56

    Chapter 1 IntroductionThere are currently millions of processors connected to the Internet. At any given moment,

    many if not most of them are idle. An obvious and appealing idea is to utilize these idle processors for running applications that require large computational power. This would allow

    what may be termed global computing a single computation carried out in cooperation between many processors worldwide.

    Similar ideas in the context of local area networks are quite well known by now, especiallydue to the influence of the work on Network of Workstations [1]. There are several addedcomplications, though, in the global case of cooperation over the whole Internet. First, there aremajor technical difficulties due to code mobility, security, platform heterogeneity, andcoordination concerns. Then there is a matter of scale as the Internet is much more distributed:The communication bandwidth is smaller, the latency higher, the reliability lower. On the

    positive side, the potential number of processors is huge.

    A much more fundamental difference is due to the distributed ownership of the processors on

    the Internet. Since each processor is owned and operated by a different person or organization,there is no a-priori motivation for cooperation (why should my computer work on your problem?)Clearly a motivation for cooperation, such as payments for CPU time, must be provided by aglobal computing system.

    The POPCORN system provides an infrastructure for such global computation, addressingall these difficulties. It has been implemented in Java [2] and may be used over the Internetthrough its web site [3]. Descriptions of the system can be found in [4, 5, 6, 7].

    This work focuses on POPCORNs approach to the last issue, that of motivating cooperation.The POPCORN system provides an online electronic market for trade in CPU-time. Buyers andsellers of CPU-time connect to it via the Internet, and the market matches buyers and sellersaccording to economic criteria. It should be emphasized that the buyers and sellers are computer

    programs (acting for humans) rather than directly humans. It seems very likely that such totallyautomated electronic markets will play a large role in many forms of internet cooperation (not

    just for CPU time), and that general mechanisms for such markets need to be developed andunderstood.

    The design and implementation of such online electronic markets will of course draw on thevast literature available regarding real-world markets [8, 9, 10, 11, 12, 13, 14, 15]. However, one should notethat many differences exist. First, there are many technical issues of communication,implementation, etc. Second, the fact that the market is not intended for humans but rather for

    programs makes a difference. Third, in many cases, and in particular in the case of the

    POPCORN market, even the basic definitions of money, goods and trade need to be defined. Wehope that our experiences with the POPCORN market may shed further light on several aspectsof online electronic markets.

    1.1 The POPCORN System Global Computation over theInternet

    The POPCORN system provides an infrastructure for global computation over the Internet.POPCORN's basic function is to provide any programmer on the Internet with a simple virtual

    parallel computer. This virtual machine is implemented by utilizing all processors on the Internetthat care to participate at any given moment. The system is implemented in Java and relies on its

    ubiquitous applet mechanism for enabling wide scale safe participation of remote processors.There are three distinct entities in the POPCORN system:

  • 8/2/2019 Ori Thesis

    6/56

    1. The parallel program written (in Java) using the POPCORN paradigm andAPI. This program acts as a CPU-time buyer . The programming paradigmwas designed as to fit global computing.

    2. The CPU-time seller which allows its CPU to be used by other parallel programs. This is done as easily as visiting a web-site using a Java-enabled browser, and requires no download of code.

    3. The market which serves as a meeting place and matchmaker for buyersand sellers of CPU-time.

    The buyer program, using the POPCORN programming paradigm, achieves parallelism byconcurrently spawning off many sub-computations, termed computelets . The POPCORNsystem automatically sends these computelets to a market (chosen by the user), which thenforwards them to connected CPU-time sellers, who execute them and return the results. Thematching of buyers and sellers in the market is dynamic, is done according to economicmechanisms, and results in a payment of the buyer to the seller.

    The system is clearly intended for very coarse-grained parallelism. The efficiency is mostlydetermined by the ratio between the computation time of computelets to the communication effortneeded to send them and handle the overhead. To achieve high efficiency, computelets should berelatively heavy in terms of computation time. Currently, seconds of CPU-time per computeletare a minimum, and tens of seconds seem more typical. For very large-scale computations, evenhours make sense.

    A POPCORN application proceeds along a single main thread (which runs on the local processor). This thread keeps spawning sub-computations to be executed remotely. Each suchsub-computation is executed asynchronously on some remote processor. A Computelet objectencapsulates a remotely executed sub-computation. The computelet is transmitted to the remote

    computer and is executed there. We should emphasize that a computelet is a true object: itincludes both the code to be executed as well as the data that this code operates on. Thecomputelet is constructed at the local host, is sent to a remote host, and a pre-specified methodgets executed there. The result, which can be any object, is then sent back to the local host.

    The distributed POPCORN program deals with a somewhat higher-level abstraction than thecomputelet; an object termed a Computation Packet . The heart of a computation packet isindeed the computelet that executes its main function. However, the computation packetencapsulates in addition all information regarding the local processing of this computelet: How itis constructed, the price offered for it, how it is handled locally when the answer arrives, how it isverified, what happens if the remote computation fails somehow, etc. When a computelets resultarrives, the enclosing computation packet receives a notifying event and handles the result. This,in turn, may result in the construction of new computation packets. Full details of the POPCORN

    programming paradigm can be found in the POPCORN tutorial [7, 16].

    Detailed descriptions of the POPCORN system can be found in [4, 5, 6, 7]. The system maycurrently be used on the POPCORN market web site [3]. Further, and continually updatedinformation can be found on the POPCORN web site [5].

    1.2 A Micro-Economy of CPU timeIf we want owners of processors to donate their CPU time, they should be motivated do to

    so. There are many possibilities for such motivation ranging from friendly co-operation rangingto real cash payments. In any case, any general enough mechanism will result in what may beclearly called a market for CPU time: the process by which seekers (which are now buyers) and

    providers (which are now sellers) of CPU time meet and trade.

  • 8/2/2019 Ori Thesis

    7/56

    1.2.1 The GoodsThe first question one must ask in such an electronic market is what exactly we are trading.

    The answer CPU time is not accurate enough since it lacks specifics such as units, differences between processors, deadlines, guarantees, etc. There is a basic tradeoff between allowing the

    traders to give very specific description of the goods, and maintaining a small number of uniformtypes of goods with a larger market size. Our approach has been to emphasize uniformity in theinitial implementation, but building the infrastructure to allow specialization in later versions(with hopefully larger market activity.)

    Our basic goods are the JOP s Java Operations. This is the Java equivalent of thecommonly used, though imprecise, FLOPS. Of course, there are different types of Javaoperations, with different costs in different implementations, so we define a specific mix of computations and use this mix as a definition. Each computelet size is measured by the number of JOPs it consumes, and the price for a computelet is proportional to the number of JOPs it actuallytook to compute remotely. The measurement procedure is described in chapter 4. For the time

    being, simply assume that the computelet size is measured somehow and that this information isreported back to the market.

    1.2.2 The MoneyOne may think of several motivations for one processor to provide CPU-time to another:

    1. Friendly situation where both processors belong to the same organization or person

    2. Donation

    3. Straightforward payment for CPU time

    4. Barter getting in return some type of information or service

    5. Loan getting CPU time in return in some future date

    As in real life, all of these motivations, as well as others, may be captured by the abstractnotion of money . This money may be donated, traded, bartered, loaned, converted to other currency, etc. This is the approach taken in POPCORN: we define an abstract currency called a

    popcoin . All trade in CPU time is ultimately done in terms of popcoins. In our currentimplementation, popcoins are just implemented as entries in a database managed by the market,

    but they can be easily implemented using any one of the electronic currency schemes [17]. Eachuser of the POPCORN system has a popcoin-account, paying from it for required CPU time, or depositing into it, when selling CPU time. The market automatically handles these financialaspects throughout the computation. Once this mechanism exists, all of the motivations describedabove are obtained by administrative decisions: To get true payment for CPU time, one can

    provide a conversion between popcoins and US$ (we do not). In a friendly situation, justignore popcoin amounts. To loan CPU cycles, just buy CPU time with popcoins and at another time sell your CPU time for popcoins.

    1.2.3 Buying and Selling CPU timeA parallel POPCORN application is in fact buying CPU time. The parallel program must

    offer a price for the computation of each computelet. The payment is executed on sellers returnof the answer to the market, and is deducted from the buyers account in the market. Technically,each computation packet constructs a Contract object that encapsulates the offer. The contract

    specifies the prices offered, whether the price is per computelet or per JOP, and the market

  • 8/2/2019 Ori Thesis

    8/56

    mechanism required for this transaction (see below). The contract may be hard-coded into the program; alternatively, we provide a user-level tool for specifying the contract.

    Selling CPU time is simply done by visiting a page on the web with a Java-enabled browser.This page contains an applet that starts working on the sellers computer and which repeatedlyreceives computelets and computes them. In the most direct form, a seller visits the markets website, where he is asked to provide his account information (name and password). Once thisinformation is provided, a start computing button starts the CPU-selling process, and all

    popcoins earned are deposited into this account. By default, each seller simply auctions his CPU-time to the highest bidding prospective buyer. The seller may also enter his preferences for thetrade, e.g. specifying pricing information (see below).

    An alternative mechanism exists, which does not require the seller to hold an account, or to be compensated in popcoins. In this variant, a seller visits a web page that is of some interest tohim. In addition to this interesting information, the page contains the POPCORN logo . Thislogo has two main functions. First, the logo is an applet that receives computelets and executesthem. Second, this logo explicitly informs the user that this is going on. In this situation, the seller is in fact bartering his CPU time for the information on the web page. This can be an on-linegame, a picture, or any other type of information. We maintain a little gallery of such web-

    pages (currently we have a couple of simple games as well as some digital art [18].)

    We have provided a general mechanism, by which any person who has such interestingonline information may get, in effect, paid for this information with popcoins, and become, whatwe term, a POPCORN publisher . Such a publisher embeds the POPCORN logo in his page,which results in the automatic selling of CPU cycles of anyone visiting his page. All the popcoinsearned for the computations done by these visitors go to the publishers (previously opened)

    popcoin account. In effect we have a 3-way trade here: the seller provides CPU time and getsinformation; the publisher provides information and gets popcoins; and the buyer provides

    popcoins and gets CPU time. Exact details on how to become a publisher can be found at[19]

    .

    Figure 1.1 (left): A game web page with the POPCORN logo (top right corner). Figure 1.2 (right): POPCORN seller web page.

    1.2.4 The MarketThe immediate function of the market is to serve as a well-known location, to which buyers

    and sellers come, instead of trying to look for each other over the entire Internet. There can bemany different markets, but supposedly, each is in a well-known location. Obviously, thismakes the market a bottleneck of the entire system, but as long as the computation done by each

  • 8/2/2019 Ori Thesis

    9/56

    computelet is CPU-time-consuming enough relative to the market overhead, a single market canhandle large numbers of buyers and sellers. The market is a trusted intermediary and isresponsible for matching buyers and sellers, for moving the computelets and results betweenthem, as well as for handling all payments and accounts. The implementation of the marketinvolves a server that buyers can connect to as clients, as well as a set of web pages with applets

    embedded in them (and a supporting server) for the sellers to connect to. The most importantaspect of the market is to match buyers and sellers according to economic criteria. We have threedifferent auction mechanisms currently available [20, 21, 22 ]. They are handled as separate internalmarkets and each buyer and seller chooses the desired mechanism (in addition to choosingwhether the payment is per JOP or per computelet).

    The first mechanism is the repeated Vickrey auction [23] (i.e. multiple rounds of the Vickreyauction ). Here, the CPU-time of the sellers is auctioned among current buyers. This auction is

    performed whenever a new computelet is to be sent to a seller. In each round of this auction, buyers submit sealed (confidential) bids to an auctioneer. The winner is the highest bidder, who pays a sum that equals the second highest bid. In the version to be described, the auctions are

    conducted by seller brokers, and the bidders are buyer brokers (the buyers and sellers arerepresented at the market by brokers that act on their behalf). The reason that we use such astrange mechanism is that subject to some assumptions, buyers and sellers have dominantstrategies, when participating in a single round of the auction. In this case, the seller may specifyan entry price, and the buyer needs to specify a bid (that may change between rounds).

    The second mechanism we provide is a simple double-auction [24]. In this mechanism, buyersand sellers submit a low price, a high price, and possibly a rate of change. The sellers start withan offer of the high price an offer, which is automatically decreased, at the specified rate, until a

    buyer is found (or the low price reached). Similarly, buyers start at the low price, and their offer is automatically increased until a seller is found (or the high price is reached). When a buyer meets a seller, the buyers computelet is sent for execution on the sellers machine and the

    payment is at meeting price. This mechanism results in stock-market-like behavior, and is verydynamic and easy to define and implement.

    The third mechanism we provide is a repeated clearinghouse double auction [24]. Thismechanism is very similar to the previous one, except that in each round more than one buyer-seller pair is matched. A single price is used for all the transactions of a given round.

  • 8/2/2019 Ori Thesis

    10/56

    Figure 1.3 (right): A snapshot of connections to the market.

    1.3 Market AnalysisFrom an economic point of view, our main interest is weather the gains-from-trade that are

    generated by the markets, are maximized. We are also interested in the algorithmic andcommunicational complexity of the mechanisms. The most important computational issue in theInternet environment is probably the communication complexity.

    Our analysis of the repeated Vickrey mechanism shows that it has limited value for our needs.We show that the mechanisms allocation is socially optimal, subject to very restrictiveassumptions about the environment. We also show that when some of the assumptions aredropped, the efficiency result no longer holds. These results are also verified by simulations.

    For the simple double auction mechanism we do not provide a formal treatment and we aresatisfied with informal discussion and simulations. Simulations show that the mechanism isquite efficient. We found that the social efficiency of the allocation depends on the relativeintensity of buyers and sellers orders. As the sellers/buyers ratio grows, the efficiency of theallocation decreases. Overall, our simulation results support the use of the simple double auctionas a POPCORN mechanism.

    Our main result for the repeated clearinghouse mechanism is that it is extremely efficient, andtherefore suitable to use as a POPCORN market mechanism. We rely on the literature that

    provides evidence for the mechanisms efficiency. We do not carry out a complete efficiencyanalysis for this mechanism and we use simulations instead. Simulations show that themechanism is very efficient, when it is compared to the optimal offline allocation. We found thatthe its generated welfare is between 95% and 99% of the optimal value.

    We use simulations to check the behavior of prices in response to shifts in demand and supply.We find that all three mechanisms respond to these shifts as we expected. We also check thevolatility of prices, and find that the clearinghouse double auction is the most stable mechanism.The prices in the repeated Vickrey auction are less stable and the simple double auction is theleast stable mechanism.

  • 8/2/2019 Ori Thesis

    11/56

    These results and the discussion in the following chapters lead us to the conclusion that amongour suggested mechanisms, the clearinghouse double auction is the most appropriate for our environment.

    In addition to the economic analysis, we analyze the algorithmic and communicationalcomplexity of these mechanisms and show that they are quite low. We also describe theeconomic-infrastructure architecture from a software-engineering point of view and explain itsmodularity, flexibility, and scalability. We explain how the use of contracts and brokersminimizes communications, reduces the complexity of the software, and contributes to theflexibility of the system.

    1.4 Main ResultsThis work contributes to the better understanding of market-based computational systems in

    three main areas:

    Architecture for online market-based systems is presented. The infrastructure may be usedin the future developments of online markets.

    A framework for evaluating computational market-based systems is developed. We feelthat our framework can be used for the evaluation of other similar systems as well.

    A better understanding of three specific market mechanisms is gained within the proposedframework. In particular we find that the clearinghouse double auction is superior to theother mechanisms in the context of online markets for CPU time. Our results may begeneralized to other, non-CPU markets, assuming that some conditions hold in the newenvironments.

    1.5 Thesis Structure

    Chapter 2 deals with the modeling and the formal analysis of the various markets. Theanalysis is partial and many questions remain open. Some of these questions are answered bysimulations, which are the topic of chapter 3. Chapter 4 describes the architecture of POPCORNs economic infrastructure. Chapter 5 outlines directions of further research. AppendixA provides a survey of related economic-oriented works in computer science.

  • 8/2/2019 Ori Thesis

    12/56

    Chapter 2 Towards an Analysis of the POPCORNMarkets

    The basic question about our market mechanisms is whether they work well in terms of finding an economically efficient matching of buyers and sellers, in the dynamic environment of the Internet. In addition, the computational efficiency of finding the matching is also importantwhen the market faces high loads. The following results are quite sensitive to the exact model of the buyers and sellers as well as to the economic utility placed on time and to the informationavailable to the players. Some results from game theory and mechanism design literature [25] aredirectly or indirectly applicable, yielding both positive and negative results.

    The trade in a given market is governed by a market institution 1 - a term that refers to a set of rules that specify the set of legitimate messages among the traders, how and when the traderstransact, the goods that are being traded, etc. One way of analyzing a POPCORN market is toview its rules as defining a multiple-round game of incomplete information, in which the number of players may change as time progresses and the players actions in one round affect the futurerounds. Each trade-round at the market corresponds to one round in the game. The players of thegame are the selfish buyers and the sellers, who seek to maximize their private utility. The gameis a game of incomplete information [26] because the players do not know their opponents utilityfunctions 2. The game that fully corresponds to the POPCORN trade is difficult to analyzeformally, and therefore we make some simplifying assumptions in our discussion below 3. Theanalysis of the single-round case will show that it is quite reasonable to assume non-strategic(truth-telling) behavior on the part of buyers and sellers. Hence, when we analyze themechanisms in their repeated form, we assume that buyers and sellers are truth-tellers.

    We use economic criterions for telling a good mechanism from a bad one. Our maininterest is the social efficiency of the allocation. Specifically, in order to evaluate a given

    POPCORN institution, we check if its allocation maximizes the total welfare of the economy. Inorder to calculate the total welfare that is generated by an allocation, i.e. we sum up the utilitiesthat each agent gains from this particular allocation. We use a criterion known as thecompensation criterion: Given two allocations x and x , the allocation x is said to be potentially

    Pareto preferred to x if there is someway to reallocate x , so that all agents prefer the reallocationof x over the allocation x . If there does not exist any allocation that is potentially Pareto

    preferred to the mechanisms allocation then the welfare of the economy is at its maximal value 4.

    In its general form, the Popcorn good can be defined as the right to compute subject to someagreed upon terms. Different term define different goods. The preferred agreement at the time of writing these lines is based on the per-JOP billing scheme. It is probably the case that the

    buyers utility is gained from higher level entities than JOPs but we assume that the buyersutility is gained directly from the JOPs. Similarly, we assume that the sellers utility stems fromhis profits in Popcoins. Therefore, when the per-JOP scheme is used, we expect the market priceof this good to reflect both the cost of producing it (by sellers) and its social value (to buyers) 5.

    1 We use the terms market institution and market mechanism interchangeably.2 We always assume that the rules of the game are common knowledge [25] among the buyers and sellers and that the system

    makes sure that these rules are enforced.3 In particular, we provide a simple model of the buyers and sellers and use this model to predict their rational behavior in a

    single round of trade.4 This criterion is different from other criteria for evaluating scheduling mechanisms. Were not interested in the minimization

    of objective functions like, makespan , total waiting time , total flow time etc. [52] , and were not dealing here with a central

    planner seeking to minimize one of these objectives.5 This is not the case when the computelet price is fixed or is a function of computation time alone. If that is the case, we wouldface a POPCORN variant of the tragedy of the commons [46] in the CPU time resource.

  • 8/2/2019 Ori Thesis

    13/56

    Furthermore, it can be shown that when this is not the case, the societys welfare is notmaximized and the allocations are not efficient [14]. The scheduling of computelets is non-

    preemptive and consequently the good is indivisible.

    Buyers and sellers notify POPOCORN of their desires by sending asynchronous orders to the brokers. The connect order and the disconnect order of both buyer and seller are defined bytheir time. The bid and ask orders are defined by the their time and price limit.

    In order to model a buyer we assume that a buyer has a type 0iV , drawn from some probabilitydistribution F . The buyers type represents his valuation of a JOP at time 0 , and once a buyerstype was determined at time 0, his valuation of a JOP (in terms of time 0) decays as thecalculation of that JOP is done further into the future. Formally, buyer i s valuation of thecalculation of a JOP at period t in terms of period 0 is 0i

    t t i V V = , where 0iV is i s type, and

    10 is a discount factor that is common for all buyers. We also assume that if a buyer cuts adeal at time t , and buys a computation of jops L , at a price p , he enjoys a utility of )( pV L t i .Thus, our buyers are risk neutral. A buyer generates a stream of orders, beginning with a

    connect order, followed by bid orders, and finally a disconnect order.Similarly our model of a seller states that a seller is defined by a type ie , drawn from some

    probability distribution G . The sellers type is his expenses per a unit of time . Another attributeof the seller is his machines speed of second jops z i . The speed is drawn from some

    probability distribution H . We assume that if a seller cuts a deal to sell a computation of jops L ,

    at a price p , he enjoys a utility of )( p z e

    L . Therefore, our sellers are risk neutral too. A seller generates a stream of orders, beginning with a connect order, followed by at least one askorders, and finally a disconnect order. We assume that both buyers and sellers know their type

    a-priori (this is very similar to the independent private value model [27]

    ).An active seller is a seller whose machine is currently idle, and whose broker currently

    participates in the trade. An active buyer is a buyer who is currently engaged in the markets tradeactivity. An active buyer can not act as an active seller at the same time. The same holds for anactive seller. Unless stated otherwise, we assume that,

    The sum paid by the winner to the seller is equal to pc * , where c denotes the number of JOPs comprising the packet, and p denotes the price per JOP set by the auctionmechanism.

    Buyers and sellers dont know the number of their competitors.

    The bids (asks) are fixed throughout a single auction round but may change betweenrounds. The sellers broker publishes no information about his clients computer. The auctions rounds are held in fixed time intervals of d seconds. Each round consumes

    zero units of time to execute.

    2.1 The Repeated Vickrey Auction MechanismThe first mechanism to be discussed is a repeated Vickrey auction (The Vickrey auction [23] is

    also known as the second price sealed bid auction ). In this auction, buyers submit sealed(confidential) bids to an auctioneer. The winner is the highest bidder, who pays a sum that equalsthe second highest bid. In our version, the auctions are conducted by seller brokers, and the

    bidders are buyer brokers. We use a multiple-round version of the Vickrey auction, in which the

  • 8/2/2019 Ori Thesis

    14/56

    turn of the next broker to hold a Vickrey auction is based on his clients arrival time at themarket. The reason that we use such a strange mechanism is that subject to some assumptions,

    buyers and sellers have dominant strategies, when participating in a single round of the auction.

    For our initial analysis, we make the following assumptions:

    1. All the sellers machines are identical with a speed of second jops z . The sellers

    expenses for a unit of time e are the same for all sellers. Hence, the various sellers areidentical in every aspect that is relevant to our discussion, including the points in timewhen they connect and disconnect. They can be thought of as multiple copies of somegiven seller.

    2. The buyers are symmetric . Each buyer i draws his valuation at time 0 from the same probability distribution F .

    3. All of the buyers are created at time 0, although their orders may arrive at arbitrary pointsin time. This assumption may be dropped and our results would still hold, but it would

    make the notations more cumbersome.4. The sizes of all the packets are the same and equal L jops .

    2.1.1 A Single Auction RoundA well-known result in auction theory is that it is a dominant strategy for a buyer in a Vickrey

    auction to bid his true valuation of the good being auctioned [23]. The dominant strategy for a buyer exists because the players are price takers in this auction form the price the winner paysdoes not depend on his own bid 1. We also note that the Vickrey auction belongs to a special kindof mechanisms - direct-revelation mechanisms . That is, a single-round satisfies the individual rationality and incentive compatibility constraints [25].

    Thus, the outcome of a single round of the Vickrey auction satisfies the strong criterion of dominant strategy equilibrium . When the players play their equilibrium strategies the outcome of a single round is efficient the buyer that posses the highest valuation for the good wins it.Assume that the winning buyer at the round held at time t is buyer i . The welfare, generated bythe deal, is divided between the winning buyer and seller. The surplus each one of them gains,depends on the second highest bid. Denote the second highest bid by t jV . Therefore the sellers

    per-second profits from the deal are e zV t j . The buyers per-second gains would be )( t jt i V V z .Thus, the per-second social surplus from the deal chosen by the mechanism (which equals

    e zV t i ) is the maximum possible per-second social surplus on all possible deals among allactive sellers and buyers at this particular round. We assumed that the sizes of the packets areequal and so the auction maximizes the social surplus in each round.

    2.1.2 Multiple Auction RoundsHowever, our Vickrey-based mechanism is executing a Vickrey auction repeatedly and the

    properties of the single round do not necessarily hold. Despite this theoretical possibility, we donot know of practical ways by which programs can gainfully employ strategic reasoning in thecontext of the POPCORN market. If we do assume that the buyers and sellers are truth-tellers(i.e. non-strategic buyers and sellers) then we can show that the mechanism is efficient:

    1 This property only holds if we assume that the players know their types, and that the seller is committed to sell if a buyer isfound. More information about the importance of commitment can be found in [27] .

  • 8/2/2019 Ori Thesis

    15/56

    Assume that the players are non-strategic and that mechanism was run on some given finiteinput stream of orders received from the buyers and sellers. Denote by ),,( 0 r x x x = theallocation chosen by the basic mechanism in its d r * seconds of execution, where,

    = *at timeexecutetoscheduled buyer wasnoif 0

    *at timeexecutetoscheduledwas buyer if

    d k

    d k ii x

    k

    Note that the beginning of the allocation process is at time 0, and that the auction rounds are heldat discrete points. Were not stating which seller sold to which buyer, since we assumed that thesellers are all identical.

    We are interested in checking if this allocation is maximizing the welfare of the economy. Tocheck this, we need to ask if there exists a different allocation for the same input x x , which is

    potentially Pareto preferred to x . We are only interested in legal allocations:

    Definition 3:

    A legal allocation is a result of some mechanism that satisfies the following requirements:

    Deals are made at discrete points in time, which are multiples of d The POPCORN trade rules are fulfilled The payment is made according to the per-JOP scheme

    Lemma 1:

    Denote by x the allocation chosen by the mechanism throughout its rounds, over theinput stream of orders. Subject to the assumptions we have made, there exists no other legal allocation x x for the given input that is potentially Pareto preferred to x .

    The proof of lemma 1 is straightforward and is given at appendix A. It follows immediately fromlemma 1 that the allocation chosen by the mechanism is maximizing the welfare of the economy.

    2.1.3 Relaxing Some AssumptionsThe proof of the previous lemma was straightforward because of all the assumptions that we

    have made. We now consider the implications of relaxing some of them. Most of our results fromthis point onwards show that in settings that are more realistic the mechanism is no longer efficient in its repeated form. This is not surprising, considering the complexity of the real

    problem and the relative simplicity of the mechanism. A more detailed analysis might show thatthe mechanisms allocations are not so far from being efficient, but we have not carried out suchan analysis. A situation similar to the one were dealing with, in which many goods are

    sequentially sold in one-sided auctions, is seldom analyzed in general settings due to itscomplexity. Furthermore, the existing theoretical and experimental studies show that in thegeneral case, repeated auctions lead to inefficient outcomes [28, 29, 30]. In the following subsections,we try to see what happens to our mechanism when each of the problematic assumptions isrelaxed.

    2.1.3.1 Heterogeneous Sellers (various machines speed)

    We have assumed that all the sellers machines are identical, and the sellers expenses per unit of time are the same for all sellers. The machines connected to the Internet differ in their computation power, connection quality, and the costs of connection differ from one ISP toanother etc. Therefore, this homogeneity assumption must be relaxed if we want to evaluate our

    system realistically. We first check the effect of heterogeneous machines, and in the next sectionsthe effect of heterogeneous costs.

  • 8/2/2019 Ori Thesis

    16/56

    When introducing sellers with different speeds the previous lemma is no longer valid. Thereason is that the time, at which the computation ends, now depends on which seller computes for a given buyer and the mechanism ignores the computer speed when scheduling the next seller tohold an auction. As a trivial counterexample, consider the case where there are two buyers,

    21 , B B , each buyer wants to buy one packet and two sellers 21 , S S . Assume that

    popcoinsV 10001 = , popcoinsV 5002 = , 9.0= , sec jops z 1001 = , sec

    jops z 502 = . Assume also that

    both of the sellers have connected to the market before the buyers, and that 2S has connected before 1S . In this case, the mechanism will match 1 B with 2S and 2 B with 1S . The total gainsfrom trade in this case would be 4.12850*9.0100*9.0 2/12 =+=W . However, had the mechanismhas chosen to match 1 B with 1S and 2 B with 2S the total gains from trade would have been

    13550*9.0100*9.0 =+=W . Note that this problem would not exist if we assume that the buyersvaluation for packets are constant over time, and do not decay. Nevertheless, if we assume that,why would a buyer bother to use POPCORN in the first place? He can simply execute all hiscomputations on his own machine, no matter how long it takes

    Sorting the available sellers according to their computer speeds instead of sorting themaccording to their arrival time does not solve our problem. The resulting revised mechanism is agreedy online algorithm, which maximizes the per-second gains from trade over the possibledeals in every round of its execution. The gains from trade in every round equal ** eV z t i , where

    *e is the expense-per-second of the fastest seller, * z is this sellers speed, and i is the winning buyer. Such a mechanism is not optimal. A counter-example, in which the mechanismsallocation is inferior to another allocation, can be constructed but we do not bring it here. Aninteresting question is weather this algorithm is competitive [31] with respect to the possible gainsfrom trade, given a set of buyers and sellers 1.

    2.1.3.2 Heterogeneous Sellers (various production costs)

    Let }...,3,2,1{ m J = , be the group of sellers, and let },...,3,2,1{ n I = , be the group of symmetrical buyers. Let q , denote the number of identical packets to be computed by these

    buyers. To keep everything simple, assume thatl q

    is a natural number for all },...,2,1{ ml and

    that auctions of two available sellers are held at almost the same time. Denote by je the per-

    second costs of seller j . We assume without loss of generality that meee 21 , and00

    20

    1 nV V V .In the presence of various production costs on the sellers side, the optimal allocation solves the

    problem:

    = =

    1

    0 1

    0max j

    q

    i

    j

    k

    k k

    i

    J j z e

    V L .

    Note that the number of buyers is not important in this case (only the total number of packets isimportant). The mechanism does not solve this problem in the general case. It ignores the

    production costs altogether. Even if we did order the sellers according to their production costs, itwould not be sufficient. For example consider the simple case where }5,4,3,2,1{= J , je j =

    1 One conclusion from this discussion is that if the group of sellers is heterogeneous then the buyers should be informed of thesellers speed. Otherwise, the resulting allocation would not be efficient.

  • 8/2/2019 Ori Thesis

    17/56

    }2,1{= I , 120=q , jops popcoinsV V 1002

    01 == , jops L 1= , sec

    jops z 1= . If 9.0= , we getthat the social gains from trade is maximized when using all of the machines. Our mechanismwould have chosen the same allocation. When 99.0= , however, we get that the social gains-from-trade is maximized by using only the machines of sellers 1,2,3. Not surprisingly, it turns out

    that even in such a simple example, the optimal allocation is very sensitive to the discount factor.One way of dealing with heterogeneous sellers is to sort the sellers according to their entry

    prices. A seller with higher cost will impose (in general) a higher entry price. The resultingmechanism is a double auction to be discussed in the next section.

    2.1.3.3 Correlated Valuations

    One of our basic modeling assumptions was that the buyers valuations (types) wereindependently drawn from some distribution, and that after his type was determined, the buyer knows his type. From these assumptions, it followed that the buyers in the Vickrey auction had adominant strategy, and that there existed dominant strategy equilibrium for the game. However,

    we do not expect this to be the case. The number of JOPs in a packet is only an approximation for the value of the packet to the buyer . And the buyers valuations are probably correlated.

    Milgrom and Weber [32] have developed a general model for analyzing auctions. Using their model, each single round in our mechanism can be formalized. They show that when viewed as agame of incomplete information, the Vickrey auction has Bayesian-Nash equilibrium and that themechanism is a direct-revelation mechanism, for both the buyers and the seller. Finally, they

    prove that the mechanisms allocation is ex-ante efficient. It follows from their work that theseller has an incentive to report his computer true speed, even when the system does not enforcethis behavior.

    Milgrom and Webers analysis only addresses a single round and we still need to check if the

    global allocation is also efficient. It turns out that it isnt. We do not bring a counter examplehere, and only say that, again, the reason for this is that there is no competition among the sellersand their turns are determined arbitrarily. We dont know weather sorting the sellers in someother way would make the allocation ex-ante efficient or competitive 1.

    2.1.3.4 Asymmetric Buyers

    As was the case against identical sellers, when we deal with the Internet environment, itseems not realistic to assume symmetry among the various participating buyers. Computer pricesvary from one location to another, the typical computer is different, etc. We have assumed thatthe buyers valuations were independently drawn from the same distribution F . However, it turnsout that lemma 1 can also be proven for the case of various distributions. Therefore, all thats

    been said about symmetric buyers is still valid for asymmetric ones (all else equal).2.1.3.5 Packets of Various Sizes

    The proof of the lemma, extensively uses the fact that all packets are of equals size L . In thegeneral case, the various buyers would possess q packets with sizes qccc ,,, 21 , with bids

    qbbb ,, 21 attached to them. The efficiency of the mechanism no longer holds in the presence of various packet sizes. A trivial example shows why: Suppose a single seller, 1S , enters the market,when there are already two connected buyers anxiously waiting for a seller. Assume that these

    buyers have connected at approximately the same time. The first buyer, 1 B , possess a packet with

    1 Note also that when we drop the independent-private-value model, the question weather buyers know the number of their competitors becomes important.

  • 8/2/2019 Ori Thesis

    18/56

    size jopsc 11 = and with a bid popcoinsV p 100011 == . The second buyer, 2 B , possess a packetwith size with jopsc s 2= and with a bid popcoinsV p 101022 == . Assume 9.0= , and

    sec jops z 1= . The mechanism will match 2 B with 1S first. When the computation of the packet isfinished, 1 B will be matched. The total gains from such an allocation is smaller than the total

    gains from trade had the allocation been the other way around. The reason for this is that the presence of a discount factor together with the fact that the JOPs are received in chunks (when acomputelet returns) make the length of the packet important.

    2.2 The Double Auction MechanismsWe have seen that in the general case, the repeated Vickrey mechanism, described in the

    previous section, is socially inefficient. One reason for the inefficiency is that it does notintroduce competition among the sellers. A possible remedy is to consider double auctions .2.2.1 A Simple Double Auction

    The simple double auction can be described as two priority queues, one for the buyers and the

    other for the sellers. The buyers queue is ordered according to their bids. A buyer with a higher bid is positioned higher in the buyers queue. The sellers queue is ordered by the sellers ask prices. A seller that asks for a lower price is positioned higher in the sellers queue. In everyround of the repeated auction, the highest bidder is matched to the lowest asker(unless thesellers ask is higher than the buyers bid). The winning buyer pays to the winning seller anamount that is equal to the average of their offers. The buyers and sellers offers may changeacross rounds. The mechanism is simple and easy to implement.

    This mechanism resembles the simultaneous execution of two first-price sealed bid auctions . The rules of the first price sealed bid auction are the same as the rules of the Vickreyauction, except for the fact that the price a winner pays, is the highest offer in the auction - his

    own. Very much like in the case of first price sealed bid auction[27, 33, 34 , 35]

    , there is no dominantstrategy equilibrium in the simple double auction. We are left with a weaker criterion of Bayesian Nash equilibrium [25]. In addition, it is not a direct-revelation mechanism , and each round of our auction is not necessarily efficient. This is true because the buyers and sellers do not necessarilyreport their true valuations (utility-maximizing players are now strategic and honesty isnt the

    best policy). Since at equilibrium, buyers and sellers shade their bids and asks, a sellers ask may be higher than all of the buyers bids, while a buyer, whose valuation for the good is higher thanthat of the owner, exists. Furthermore, each round of the mechanism only allocates a single goodand we prefer mechanisms that allocate more than a single good in each round because thisdecreases the overhead and the price variability. We return to the mechanism in the simulationssection.

    2.2.2 The Clearinghouse Double AuctionThe basic idea in the clearinghouse mechanism (also known as the k-DA) is that the buyers

    bids define a demand curve, and the sellers asks define a supply curve. The mechanism then usesthe resulting Marshallian cross to decide on a price and quantity for trading. The intersection of the two curves defines the trading price, 0 p . Buyers who bid more than 0 p trade with sellerswho ask for less than 0 p and the market is cleared. Most of the characteristics of the simpledouble auction apply here, too. The exceptions are the price determination rule and the fact thatmore than one buyer-seller pair may trade in each round.

  • 8/2/2019 Ori Thesis

    19/56

    The clearing price 0 p in each round is determined as follows. The buyers bids are written in

    descending order, )()2()1( nV V V . The sellers ask-prices are written in ascending order,)()2()1( m A A A . We add a fictitious bid, 01 =+nV , and a fictitious ask, =+1m A . The

    mechanism then looks for the first pair ),( )1()1( ++ j j AV satisfying )1()1( ++ > j j V A . The traded

    quantity is then j , and the clearing price is )(21

    0 j j AV p += (i.e. we use k-DA with 21=k ).

    Figure 2.1 below shows how the price and quantity are determined.

    Figure 2.1: price and quantity determination of each round of the mechanism (k-DA)

    Clearinghouse mechanisms are used in some market institutions, like stock exchanges andcommodities markets [8, 9, 36].

    Once again, we make some assumptions, in order to make the problem more tractable. In particular, we assume that the sellers machines are identical, that the buyers (sellers) are

    symmetric, and that once a buyers (sellers) type was determined at time 0, his valuation remainsconstant over time.

    2.2.2.1 Properties of the k-DA (a single trading round)

    Each round of our mechanism is a k-DA, with 21=k . The gains from trade for the given thedemand and supply curves are shown in figure 2.2 by the shaded area. The shaded area, iscomprised of two triangles. The upper triangle, BG , represents the total buyers gains and thelower triangle, S G , represents the total sellers gains.

    Packets

    Price

    j A

    jV

    0 p

    Supply

    jQ =0Demand

  • 8/2/2019 Ori Thesis

    20/56

    Figure 2.2: The gains from trade

    Each buyer (seller) has some influence on the expected price 0 p , therefore he has anincentive to shade his bid (ask). Consequently, the reported demand curve is lower than thehonest-reporting demand curve. Similarly, the reported supply curve is higher than the honest-reporting supply curve. Thus, some of the gains from trade are lost.

    The single round has no dominant strategy equilibrium. Again, we turn to a weaker criterionof Bayesian Nash equilibrium (a very similar double auction mechanism, with dominantstrategies for both buyers and sellers exists [37], but the mechanism is a bit more complicated). Thecalculations of the buyers and sellers equilibrium strategies are not trivial. The mechanism is not

    a direct-revelation mechanism and each round of our auction is not necessarily efficient.However, despite all of these drawbacks, the mechanism has one important property, proven

    by Rustichini, Satterthwaite, and Williams (RSW hereafter), for the case where each buyer requests a single good and each seller possess a single good [38]. They show that as the number of

    buyers and sellers grows, the incentive for buyers and sellers to falsely report their typesdiminishes, and the gains from trade converge to the maximal possible value. Formally, RSWassume that the buyers and sellers types are drawn from probability distributions F and G respectively. Denote a buyer i s type by iv and seller j s type by ja . The buyers bid iV and the

    sellers ask j A are conditioned on iv and ja , respectively. The mechanism causes the buyers to bid lower than their types and causes the sellers to bid higher than their types but RSW show thatthe misrepresentations measured by ii V v and ii a A are ))(1( nmO + , where m and n arethe number of buyers and sellers respectively.

    The gains from trade realized by the auction is then,

    B S T i T i

    ii av , where, S B T T , are the sets

    of trading buyers and sellers respectively. RSW then define expected gains from trade as theexpected value of the realized gains from trade when traders types are distributed according to F and G . They define the potential gains from trade as the expected gains from trade if eachtrader honestly reported his type instead of strategically reporting some other value. The relativeefficiency of the equilibrium of the game is the expected gains divided by the potential gains.Then they show that there exists a constant depending only on F and G , such that the relative

    Packets

    Price

    BG

    S G

    0 p

    Supply

    Demand

  • 8/2/2019 Ori Thesis

    21/56

    efficiency of the equilibrium is at least 2)(1

    nm +

    . Hence, they show that within a constrained

    environment, the result of the k-DA is close to the classical full information optimal allocation 1.

    2.2.2.2 Multiple rounds of the k-DA

    As was the case for the Vickrey auction, more complications result from the multiple-roundsnature of the POPCORN problem, and the fact that buyers need many goods. As for the latter issue, we address it by registering each buyer order separately. Thus, if a buyer wants to buy two

    packets, then two identical orders are registered for him. This modification affects RSWstheoretical results, which no longer hold precisely [38]. The fact that multiple rounds are executedcould result in inefficient results, when the mechanism is executed against an adversary whoseeks to minimize the gains from trade. In fact, the repeated clearinghouse algorithm is not -competitive [31] for any constant . As an illustration, consider the following scenario:

    During the scenarios execution, 2> N buyers register orders. Buyer i s true valuation isi M where 2+= N M . During the scenarios execution, N sellers register orders, and seller i

    s true cost is i M 1 . The mechanism is executed for T N * seconds. Every T seconds a k-DAround is held. 5=T . We assume that the buyers valuations are constant over time, and the sameholds for the sellers costs. Each buyer wants to buy the computation of a single computelet, andeach seller connects to the market, sells one computation and then disconnects. We assume thatthe agents report their true valuations and costs. Buyer i and seller i register their orders at time

    T i *)1(1 + . Thus, at every round, a successful deal is closed, where the single trading buyer buys from the single trading seller. At the end of the scenario, all of the buyers were successful,that is all of the goods were transferred to the buyers and each deal results in a gain of one

    popcoin. The total gains from trade are N G = . Let = 2/ N Q . However, the maximal (offline)

    gains from trade are =Q

    iQiG *2 .

    Mendelson [39] analyzes a repeated clearinghouse mechanism, quite similar to the repeated k-DA mechanism. The difference is that Mendelsons mechanism does not specify how a clearing

    price is chosen among the possible clearing prices in the interval ],[ j j AV . Most of his results arenot affected by this choice. Mendelsons main assumptions are that the bids and asks areuniformly distributed over some interval ],0[ m , and that the arrival of orders from buyers andsellers are governed by identical Poisson processes with rates m ( is some constant). Heshows the demand and supply processes are independent Poisson processes in the price-space,with rates T = (where T is the interval between auction rounds). This rate represents theexpected number of buy (or sell) orders per price unit. He calls the order intensity . Oneimportant feature of Mendelsons analysis is that the players are not strategic. They report their true valuations to the mechanism. In the light of the previous discussion about a single k-DAround and RSW [38] results, this assumption is quite reasonable in our case, assuming the number of players is large. It follows from his results that,

    the clearing price 0 p is an unbiased estimator of the true underlying price. By true, wemean the price resulting from intersecting the expected supply and demand curves.

    1 McAffee [37] shows that transforming the mechanism by dropping the last trading pair and determining that buyers pay jV ,

    and sellers earn j A

    , turns the mechanism into a direct-revelation mechanism with dominant strategies of honest reporting (the proof uses the regular Vickrey argument). The new mechanism earns popcoins and McAffee shows that the unrealized gainsfrom trade in this new mechanism are also ))(1( 2nmO + .

  • 8/2/2019 Ori Thesis

    22/56

    )3)(1(32

    18

    )var( 2220

    mm eem

    p

    =

    The variance of 0 p is a decreasing function of . Also, as , the variance of 0 papproaches zero very quickly. Since T = , increasing T will decrease the variance of

    0 p .

    The facts that 2][ 0m p E = , and that the variance of 0 p decreases quickly as (or T ) increases

    are important to our discussion. Together, they informally mean, we cannot be very far from that price most of the time. Thus, situations like the example above are not likely to occur.Moreover, if the expected demand and supply curves suddenly shift to new positions (for example, when m changes), the new prices of the auction will reflect the change.

    At the time of writing these lines, we have no data for supporting or refuting Mendelsonsassumptions. The number of connections to our system is much too low for that purpose.

  • 8/2/2019 Ori Thesis

    23/56

    Chapter 3 Simulating the POPCORN TradeIn this section, we check the markets behavior and characteristics by simulating the trade that

    results from the dynamic arrival and departure of various buyers and sellers. There are manyempirically open questions, of which we consider only a few. Perhaps the most interesting issues

    are the allocations efficiency in a dynamic environment and the price response to supply anddemand shocks. In addition, we check the markets adaptivity and the relation between a sellers(or buyers) offer and his probability of closing deals. We also briefly check the effect of variability in the sellers machines characteristics.

    We conducted most of our experiments in a constrained environment. In this environment, the buyers and sellers do not behave strategically (they report their true valuations), each buyer has asingle computelet to compute, and each seller wishes to compute a single computelet. In somesimulations we have relaxed these constraints, and simulated a more realistic trade, but most of the simulations were executed in the constrained environment. Overall, in the very simplesettings of our experiments, the results are promising: The markets exhibit the expected behavior

    in terms of price trends, the efficiency of their allocation is surprisingly high, the speed of theeconomys adaptation is quite high, the prices are relatively stable, and reservation prices havethe expected effect.

    3.1 A Test-bed for Carrying out the Market SimulationsIn order to simulate the trade, we have implemented a simulations test-bed. The

    implementation provides much flexibility in varying the parameters that have influence over thetrade. Figure 3.1, below, is a schematic description of the simulation test-bed architecture.

    Figure 3.1: the simulations test-bed architecture

    The hart of the simulation test-bed is a Market Simulator object, which coordinates among thevarious simulation objects. The Market Simulator is connected to the POPCORN market througha Market Adapter , which replaces the POPCORN communication layer. This enables us to

    simulate the market mechanisms without the need for hundreds of computers and without havingto worry about communication bottlenecks (which exist in the communication layer). The Market

    The Popcorn Market

    Market Adapter

    BuyersConnections

    Events Generator

    Market Trade S imulator

    Simulated Buyers

    Computelets Events

    A Simulated Buyer

    Contract Simulation Properties

    Simulated Sellers

    A Simulated S eller

    Contract Simulation Properties

    SellersConnections

    Events Generator

    Agents Factory

  • 8/2/2019 Ori Thesis

    24/56

    Simulator is an observer of an Agents Factory , whose responsibility it is to create new buyers andsellers (we use Javas built in Model-View paradigm [40], where an object registers itself as anobserver of another observable object).

    The Agent Factory observes two events generators: a Buyers Creation Events Generator anda Sellers Creation Events Generator , which generate the buyer and seller creation events,respectively. The generators generate stochastic processes of some kind. We have experimentedwith a few types of generators, and the results we bring below, use a Poisson Process Event Generators . The characteristics of the agents creation processes are configurable through externalfiles.

    The Agent Factory creates objects of type Simulated Buyers and Simulated Sellers . Theseobjects represent buyers and sellers in our system. Upon creation, a Simulated Buyer (or Seller)reads a file his contract and other characteristics. For example, the value that a buyer attributes tothe traded good and his bid characteristics are externally configurable this way. Another exampleis the Simulated Sellers machine characteristics (e.g. its CPU speed). Most of the parametersthat are read this way are defining a probability distribution, from which a Simulated Buyer (or Seller) draws the actual parameter to be used during the simulation.

    A special type of Simulation Computelets was used during the simulations. A SimulatedComputelet size (in JOPs) is determined by its owning buyer. When such a computelet reaches aSimulated Seller, it is informed of the sellers machine speed and as the computelets computemethod is invoked, it goes to sleep for the appropriate time period.

    3.1.1 Simulated BuyersOne important characteristic of the Simulated Buyer is his computelets spawning process.

    The spawning of the computelets is governed by some stochastic events generator, which is partof every buyer. The buyer reads his spawning policy as part of his characteristics, upon

    creation. Again, the parameters are different for each buyer, and are drawn from probabilitydistributions. A related characteristic of the buyer is his computelets lengths.

    Another important characteristic of a buyer is his valuation for the good and the derived bidding strategy. The buyers valuation determines the possible (rational) strategies, and each oneof the possible strategies can be chosen. This strategy is defined by his open bid, bid incrementrate, and maximum bid. The type of market mechanism, which the buyer wishes to use, is fixedthroughout the simulation. A buyer quits the system, after all of his computelets results havereturned.

    3.1.2 Simulated SellersSimulated Sellers are very much like simulated buyers. The important attributes of a

    simulated seller are his entry price, selling strategy, machine speed, and lifetime period. Theselling strategy is similar to the buyers buying strategy, and is defined by the sellers contract.The sellers machine speed and lifetime period are drawn from uniform distributions.

    3.2 Simulations and Results3.2.1 Price response to changes in the relative supply and demand

    In this set of simulations, we check the dependence between price and supply, while holdingthe demand (stochastically) fixed at some level. By collecting a large number of such samples,we are able to map the average price curve.

    The environment is consisted of truth-telling buyers and sellers, each buyer wishes tocompute a single packet of random size and each seller wishes to compute a single packet. All the

  • 8/2/2019 Ori Thesis

    25/56

    sellers machines speeds are identical. Buyers packets valuations and the sellers costs are drawnuniformly from the interval ]30,0[ . Buyers and sellers arrivals are governed by different Poisson

    processes. The Poisson process that determines the arrival of buyers remains constant throughoutthe simulations in this set, with fixed at 0.001 (the time units are milliseconds). The Poisson

    process that governs the arrival of sellers is different in each simulation run, thus we achieve thechanges in the supply.

    We have run about forty simulations for each mechanism, three times for each value of thesupply process lambda. All of the results that we bring next are based on measurements that weremade during a steady state phase (i.e. when the percent of fulfilled requests out of the totalnumber of requests is relatively stable). This steady state was reached after about eight minutes of simulation. Figures 3.2, 3.3 show a typical convergence to steady state in two mechanisms.

    Figure 3.2 (left): convergence to a steady state in the repeated double auction

    Figure 3.3 (right): convergence to a steady state in the repeated Vickrey auction

    The average duration of a simulation was thirty to forty minutes (it varied due to memory

    limitations of the PC, on which the simulations were executed). We summarize all the priceinformation in figure 3.4. The X-axis describes the relative supply (number of fulfilled buyer requests divided by the total number of buyer requests). The Y-axis describes the resultingaverage price at steady state.

    Figure 3.4: prices under different buyer/seller ratios

    In general, these results comply with our expectations, regarding the behavior of prices. It isevident that an increase in the supply results in a decrease in the average price. Consider, for example, the clearinghouse mechanism. In this case, increasing the supply process lambda results

    0

    5

    10

    15

    20

    25

    30

    0% 10% 20% 30% 40% 50% 60% 70% 80% 90% 100%

    Percent Of Buyers Fulfilled Requests

    Vickrey AuctionSimple Double AuctionClearing House

    0.00

    0.10

    0.20

    0.30

    0.40

    0.50

    0.60

    0.70

    0.80

    0.00 200.00 400.00 600.00 800.00 1000.00 1200.00 1400.00 1600.00 1800.00

    Time (seconds)

    0.00

    0.10

    0.20

    0.30

    0.40

    0.50

    0.60

    0.70

    0.80

    0.00 500.00 1000.00 1500.00 2000.00

    Time (seconds)

  • 8/2/2019 Ori Thesis

    26/56

    in the flattening of the supply curve in every round. Since the prices are determined (in this case) by finding the crossing point of the demand and supply curves, for each value of lambda we get adifferent point on the expected demand curve.

    3.2.2 Social Efficiency of the Allocations

    In order to evaluate the economic efficiency of these allocations, we compare them to theoptimal-offline mechanism. That is, we compare the generated welfare of POPCORNs onlinemechanisms to that generated by a perfect mechanism that , in advance , has all the informationabout the buyers and sellers orders. The quotient of these two numbers represents the relativeefficiency of the mechanism. This comparison is not fair towards the POPCORN onlinemechanisms. They should be compared with the best online mechanism that bases its decisionson exactly the same information that is available at runtime [41]. Nevertheless, comparing our mechanisms allocations with the optimal offline allocations is still enlightening.

    Figure 3.5: economic efficiency under different buyer/seller ratios

    Figure 3.5 shows that although we compare our mechanisms to an optimal offline mechanismtheir relative efficiency is quite high. In the case of the clearinghouse mechanism, it is very highwith the average of %96 (!). We also see that the simple double auction and Vickrey do notachieve such good results. The source of this difference is sellers with high costs that are matchedto buyers instead of sellers with lower costs, who have not reached the market yet (recall theexample in the discussion of multiple rounds of the k-DA). When these lower-costs sellers arrive,

    it is too late, since the relevant buyers have already left. This effect has lower influence over theclearinghouse results, since with this mechanism, the trade is executed in round within fixedintervals.

    We also verify by simulation that our result from chapter 3 for the Vickrey auction withhomogeneous sellers holds (figure 3.6). The average efficiency in this case is %98 . The slightloss in the efficiency was a result of a bug in our implementation that caused some of the packetsto be lost sometimes

    0%

    10%

    20%

    30%

    40%

    50%

    60%

    70%

    80%

    90%

    100%

    0% 10% 20% 30% 40% 50% 60% 70% 80% 90% 100%

    Percent Of Buyers' Fulfilled Requests

    Vickrey AuctionSimple Double AuctionClearing House

  • 8/2/2019 Ori Thesis

    27/56

    Figure 3.6: economic efficiency under different buyer/seller ratios inthe repeated Vickrey auction with homogeneous sellers

    3.2.3 Prices StabilityFor a particular mechanism, the standard deviation of prices remains stable at the various

    supply levels. This standard deviation should be considered in conjunction with the price level.We are interested in the quotient of the measured standard deviation and the average price level.We can use these measurements to compare the two double auctions: The average value of thequotient in the clearinghouse market is 147.0 , and in the simple double auction, it is 33.0 . Thus,the clearinghouse is much more stable. Figures 3.7, 3.8, 3.9, below show the price behavior in atypical run of each of the three mechanisms.

    Figure 3.7 (upper left): price behavior in the Vickrey auction

    Figure 3.8 (upper right): price behavior in the clearinghouse

    Figure 3.9 (bottom): price behavior in the simple double auction

    0.00

    5.00

    10.00

    15.00

    20.00

    25.00

    30.00

    35.00

    0.00 200.00 400.00 600.00 800.00 1000.00 1200.00 1 400.00 1600.00

    Time (seconds)

    0.00

    5.00

    10.00

    15.00

    20.00

    25.00

    30.00

    35.00

    0.00 500.00 1000.00 1500.00 2000.00

    Time (seconds)

    0.00

    5.00

    10.00

    15.00

    20.00

    25.00

    30.00

    0.00 200.00 400.00 600.00 800.00 1000.00 1200.00 1400.00

    Time (seconds)

    0%

    10%

    20%

    30%

    40%

    50%60%

    70%

    80%

    90%

    100%

    0% 10% 20% 30% 40% 50% 60% 70% 80%

    Number of Fulfilled Requests / Total Number of Requests

    E f f i c i e n c y

  • 8/2/2019 Ori Thesis

    28/56

    3.2.4 Market AdaptationIn section 3.2.1, we saw that the markets adapt to changes in the demand and supply for CPU

    time. The adaptation speed may be important in some cases. We have not carried out a thoroughinvestigation of this issue, but from the collected data, we see that the various markets stabilize at

    about the same speed. In all our simulations, the markets reached steady state within 85 minutes of simulation. This period is the same for all levels of supply and across the variousmarkets.

    3.2.5 The Role of Reservation Prices Normally, a higher buyer offer results in a higher probability of buying. Symmetrically, a

    lower ask results in a higher probability of selling. This property is verified for our markets andfigures 3.10, 3.11 depict this property for the clearinghouse market. Note that buy offers that arelower than a certain threshold, or asks that are higher than a threshold, never execute. Weobtained similar results for the repeated Vickrey auction and the simple double auction.

    Figure 3.10 (left): the probability of executing vs. the bid in the clearinghouse auction

    Figure 3.11 (right): the probability of selling vs. the ask in the clearinghouse auction

    3.2.6 Other Market PropertiesIn the previous simulations, the demand was held fixed, and the supply varied. Qualitatively,

    we got similar results, in the case of demand shifts. Similarly, we got the same results when buyers and sellers are interested in more than a single packet.

    We have verified the following assumptions:

    An increase in the average size of packets interprets to an increase in demand.

    Slowing the sellers machines interprets to a decrease in the supply.We have also experimented with heterogeneous machine speeds. We have not carried out a

    thorough investigation of this issue, but from our limited experience, it seems that the sameresults hold in this case too.

    An obvious extension to our simulations is experimenting with strategic buyers and sellers.The important questions about the effects of sophisticated strategies on our results remainunanswered. Our early experiments with strategic buyers and sellers, who shade their bids andasks and reveal more information as the trade continues, seem to hint that similar results may be

    proved by simulations for such buyers and sellers, too.

    0.00

    0.01

    0.02

    0.03

    0.04

    0.05

    0.06

    0.07

    0.08

    0.09

    0.10

    0.00 5.00 10.00 15.00 20.00 25.00 30.00

    Buyer Offer

    P r o

    b a

    b i l i t y

    t o B u y

    0.00

    0.01

    0.02

    0.03

    0.04

    0.05

    0.06

    0.07

    0.08

    0.00 5.00 10.00 15.00 20.00 25.00 30.00

    Seller's Ask

    P r o

    b a

    b i l i t y

    t o S e

    l l

  • 8/2/2019 Ori Thesis

    29/56

    Chapter 4 The Architecture of POPCORNs EconomicInfrastructure

    We now describe the architecture of POPCORNs economic sub-system. We describe thevarious POPCORN entities that are related to the economic infrastructure. Technically theseentities are implemented as Java objects, but we do not get into implementation details likeinheritance hierarchies. In principle, the various entities could have been implemented in every

    programming language. The use of an object-oriented language, such as Java, makes life easier because encapsulation integrates naturally into the languages constructs. We can envision adifferent implementation of some of these entities as CORBA [42] or C++ [43] objects and the samearchitecture would still apply. We also explain the consequences of the chosen architecture.

    4.1 ContractsThe POPCORN system uses the concept of a contract to define the details of the bond

    between POPCORN and a buyer or seller. A contract may be short lived, for example a single

    session contract, or may be kept in the markets database across sessions and be used as thedefault contract, when no other contract is supplied. In the current implementation, there are twogeneral types of contracts: A buyer contract, which describes the rights and obligations of aPOPCORN buyer and a seller contract, which does the same thing for a POPCORN seller. Thecontract is consisted of sections, and each of these sections describes an aspect of the bond.

    4.1.1 The Buyer ContractThe most important section of the buyer contract is the part that defines the buyers bid. The

    bid defines the buyers current offer for the good that he wants to buy. This offer may changeover time, and the manner in which it changes, is defined by the bid. The means of paymentsection defines how the buyer wishes to pay. At the time of writing these lines, the onlyacceptable means of payment are popcoins. Another important section defines the type of mechanism that the buyer wishes to use for trading. The buyer can choose each of the availablemechanisms.

    4.1.2 The Seller ContractThe seller contracts parallel of the bid section in the buyer contract, is the ask . The ask

    defines the sellers current demand for the good that he is offering to sell. This ask price maychange over time, and the manner, in which it changes, is also defined by this section. The seller contract also contains the means of payment section, and a section that defines the desiredtrade mechanisms. These sections have the same meaning as the corresponding sections in the

    buyer contract.

    4.1.3 Defining the ContractsThe buyer contract can be defined programmatically through API that was defined for that

    purpose. Alternatively, it is more easily defined by a GUI-based contract editing tool (see figure4.1). The tool is part of the Buyer Environment Configuration tool. The buyer can attach acontract to a specific computation packet, or alternatively use a single contract for an arbitrarygroup of computation packets.

    The seller contract can only be defined by a GUI-based contract editing tool (figure 4.2),which is accessible online for registered POPCORN sellers.

  • 8/2/2019 Ori Thesis

    30/56

    Figure 4.1 (left): visually manipulating a buyers contract (the buyer environment application).

    Figure 4.2 (right): visually manipulating a sellers contract (the seller administration applet).

    4.1.4 ConsequencesThe use of contracts contributes to the flexibility of the system, saves communication and

    helps in the resolution of conflicts. The descriptive power of a contract is limited by a particular implementation and there is a tradeoff between simplicity and generality. In the currentimplementation, a set of predefined standard contracts is used but it seems possible to use more

    general-purpose contracts, within the existing framework without the need for substantialmodifications. General contracts could provide the functionality of software-agents trade withinthe market, without the security complications. The brokers, in this case, serve as the agents,executing the contracts instructions. Contracts decrease the systems communication overheadand thus increase the overall efficiency. A contract object is relatively small, and in the case of standard contracts, it sums up to a few integers and floats. Moreover, when a few packets use thesame contract, there is no reason to send the contract with every packet, and the contract could becached in the market by the clients broker. Contracts are also used to resolve conflicts between

    buyers and sellers. A judge mechanism is being developed for this purpose, and will become anintegral part of the POPCORN system [16].

    4.2 Market StructureThe POPCORN market is abstractly defined by a set of interfaces . These interfaces are

    implemented as Java interfaces. Thus, each interface defines the publicly known part of onemarket unit. Taken together, these interfaces define the POPCORN market internal structure.

    4.2.1 Market Entities

    Market Registry - the registry is the main entrance to the market. It can be thought of as aclerk sitting at a desk by the entrance, and through him everything is entering and leavingthe market. The registry talks with the lower-level communication module. Packets aredirected by the registry to the market logic . Administration orders are directed by theregistry to the accountant . The market registry interface is defined in the Java interfacepopcorn.market.MarketRegistryInterface

  • 8/2/2019 Ori Thesis

    31/56

    Accountant - the accountant handles all the billing stuff. It handles the users accounts,moves popcoins from one account into another, as deals are closed between buyers andsellers. It also provides account administration services. The accountant interface isdefined in the Java interface popcorn.market.AccountantInterface

    Market Logic - this interface defines the part of the market that is responsible for thematching of sellers and buyers. The registry passes the packets it gets from the outsideworld to the 'market logic' module, which matches the arriving packets with pendingsellers. The manner, by which this matching is carried out, is encapsulated in the module.Below, we describe one possible implementation of the market logic. The market logicinterface is defined by the Java interfacepopcorn.market.MarketLogicInterface

    Market Monitor - the market-monitoring module is responsible for monitoring what'sgoing on in the market. This includes (but is not limited to) the monitoring of pricesfluctuations, deals throughput, connections for buyers and sellers, etc. The market monitor interface is defined by the Java interfacepopcorn.market.MarketMonitorInterface

    Postman - the postman is the market entity, through which high-level messages aredelivered to the various market entities. Each entity, which cares to receive mail fromoutside the market, registers itself at the postman. This service is high-level, and hasnothing to do with the low-level communication modules. The postman interface isdefined by the Java interface popcorn.market.PostmanInterface

    Market Communication - the low-level communication modules of the POPCORN system.This module is the subject of another work [44].

    4.2.2 Internals of the Market Logic ModuleOne possible implementation of the Market Logic interface bases its operation on competition

    among buyers and sellers. A few competitive markets are provided as part of the current versionof POPCORN. The various markets differ in the their mechanisms, and in their traded goods.Assume, for simplicity, that only a single good is being traded and that only one mechanism isused.

    The buyers and sellers are represented in the market by brokers. The brokers are implemented by Java objects and we differentiate among buyers and sellers brokers. A buyer broker receivesthe computelets that were sent by his (buyer) client and attempts to buy the CPU time neededfor their computation from seller brokers, according to the terms of the contract that was attachedto the computelet. Similarly, the seller broker, attempts to sell his (seller) clients free CPUtime. A broker is aware of his clients state (encapsulated in a ClientState object). For example, a seller broker knows the number (and identity) of the packets that were sent to hisclient, and that have not returned yet.

    The hart of a competitive market is a mechanism that enables the brokers' interaction. Thismechanism is defined by the ComputationMatcherInterface . For example, theimplementor of this interface may be an auction-house object that encapsulates an auctionmechanism. Brokers register orders at the auction-house for the selling and the buying of computelets, as dictated to them by their clients contracts. The auction matches buyers withsellers, based on the information in the registered orders and on the auction rules. For eachmatched pair, the market initiates a deal for the buying and selling of CPU time. Each deal isrepresented by a Deal object, which encapsulates all the information about that deal. Each dealis executed in a separate thread, and is executed through the cooperation of the appropriate buyer

  • 8/2/2019 Ori Thesis

    32/56

    and seller brokers. The buyer broker transfers the needed packets to the seller broker, and theaccountant is informed of the deal, which results in the transfer of popcoins, and a logging of thedeal. In the case of a client failure, the appropriate deals are canceled and the brokers recover from these situations. The recovery prevents the loss of packets, and the transfer of unjust

    payments.

    4.2.3 ConsequencesThe POPCORN market is a highly modular and extensible market. It is in effect a plug and

    play market, whose various parts can be easily replaced by new ones. The market is scalable inthe number of goods that are being traded in it. To add a new good, we extend the standardcontracts so that the agents could refer to that good in their contracts, and implement a new sub-market for that good.

    The markets computational and communicational complexities are also low:

    Normally, each arrival of an order to the market sums up to a few hash lookups, which isdone in )1(O . An exception is the cancellation of an order, which demand for the cleaningup of the brokers internal data structures. In the case of a buyer disconnection, thisoperation costs )(mO , where m is the number of packets sent by that buyer. Thedisconnection of a seller is done in )1(O .

    The matching mechanisms are also efficient, and are generally implemented as priorityqueues of orders. The operation of registering a buyer (seller) order costs )(log nO , wheren is the number of buyers (sellers). The cost of an auction round is done in )1(O . Theoperation of updating all of the orders, based on the number of trading rounds costs

    )log( nnO , where n is the number of active agents (buyers and sellers).

    A comment about our use of data structures is in place here. We have used simple heaps as priority queues. Heaps are suitable when you do not have to constantly update the internals of theheap as we do. Benchmarks show that this implementation is not efficient enough for the simpledouble auction, when the number of buyers and sellers is very big. Our measurements show thatthe market spends much time in updating the heap of orders. This, in turn, causes the market tolag behind and the orders start to pile up. The problem can be solved in our case if we note thatthe strategies of buyers and sellers are represented by continuous functions. Thus, for the marketto function it is sufficient that we keep track of the maximum envelope of the buyers functionsand the minimum envelope o