Economic Oriented CPU Sharing System for the Internet A thesis submitted in partial fulfillment of 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 Jerusalem Jerusalem, Israel July, 1998 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. 2 Acknowledgments I would like to thanks Prof. Noam Nisan for his excellent guidance, for showing me how to extract 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. 3 Contents Chapter 1 – Introduction ...................................................................................... 6 1.1 The POPCORN System – Global Computation over the Internet .......................... 6 1.2 A Micro-Economy of CPU time ............................................................................. 7 1.2.1 The Goods..................................................................................................................... 8 1.2.2 The Money .................................................................................................................... 8 1.2.3 Buying and Selling CPU time ....................................................................................... 8 1.2.4 The Market ................................................................................................................. 10 1.3 Market Analysis..................................................................................................... 11 1.4 Main Results .......................................................................................................... 12 1.5 Thesis Structure ..................................................................................................... 12 Chapter 2 – Towards an Analysis of the POPCORN Markets ....................... 13 2.1 The Repeated Vickrey Auction Mechanism ......................................................... 15 2.1.1 A Single Auction Round .............................................................................................. 15 2.1.2 Multiple Auction Rounds ............................................................................................ 16 2.1.3 Relaxing Some Assumptions ....................................................................................... 16 2.1.3.1 Heterogeneous Sellers (various machines speed) ............................................................17 2.1.3.2 Heterogeneous Sellers (various production costs) ..........................................................17 2.1.3.3 Correlated Valuations ......................................................................................................18 2.1.3.4 Asymmetric Buyers ...........................................................................................................18 2.1.3.5 Packets of Various Sizes ..................................................................................................19 2.2 The Double Auction Mechanisms ......................................................................... 19 2.2.1 A Simple Double Auction ........................................................................................... 19 2.2.2 The Clearinghouse Double Auction ........................................................................... 20 2.2.2.1 Properties of the k-DA (a single trading round) ..............................................................20 2.2.2.2 Multiple rounds of the k-DA.............................................................................................22 Chapter 3 – Simulating the POPCORN Trade ................................................. 24 3.1 A Test-bed for Carrying out the Market Simulations ........................................... 24 3.1.1 Simulated Buyers ........................................................................................................ 25 3.1.2 Simulated Sellers ........................................................................................................ 25 3.2 Simulations and Results ........................................................................................ 25 3.2.1 Price response to changes in the relative supply and demand................................... 25 3.2.2 Social Efficiency of the Allocations ............................................................................ 27 3.2.3 Prices Stability ........................................................................................................... 28 3.2.4 Market Adaptation ...................................................................................................... 29 3.2.5 The Role of Reservation Prices .................................................................................. 29 3.2.6 Other Market Properties ............................................................................................ 29 Chapter 4 – The Architecture of POPCORN’s Economic Infrastructure ..... 30 4.1 Contracts ................................................................................................................ 30 4.1.1 The Buyer Contract .................................................................................................... 30 4.1.2 The Seller Contract .................................................................................................... 30 4.1.3 Defining the Contracts ............................................................................................... 30 4.1.4 Consequences ............................................................................................................. 31 4.2 Market Structure .................................................................................................... 31 4.2.1 Market Entities ........................................................................................................... 31 4 4.2.2 Internals of the Market Logic Module ........................................................................ 32 4.2.3 Consequences ............................................................................................................. 33 4.3 The POPCORN Seller Applet ............................................................................... 34 4.3.1 Seller Structure ........................................................................................................... 34 4.3.2 Per-JOP Payment Scheme Support ............................................................................ 34 Chapter 5 – Directions for Further Research ................................................... 37 5.1 Direct Extensions................................................................................................... 37 5.1.1 Efficiency Analysis of the Double Auctions ................................................................ 37 5.1.2 More Realistic Models................................................................................................ 37 5.1.3 Comparison with non Market-Oriented Mechanisms ................................................ 37 5.1.4 Generalizing to Other Goods ..................................................................................... 37 5.2 Speculations ........................................................................................................... 38 Appendix A – Economic-Oriented Computational Systems ........................... 40 A.1 Introduction .......................................................................................................... 40 A.2 Motivations ........................................................................................................... 40 A.3 Applications .......................................................................................................... 41 A.3.1 Resources Allocation and Sharing ............................................................................. 41 A.3.2 Market for Interacting Computational Agents ........................................................... 42 A.3.3 Fault Tolerant and Adaptive Systems ........................................................................ 42 A.4 The Underlying Economy .................................................................................... 42 A.4.1 The Economy’s purity ................................................................................................ 42 A.4.2 The Economy’s Agents ............................................................................................... 42 A.4.3 The Goods .................................................................................................................. 43 A.4.4 The Information Structure.......................................................................................... 43 A.4.5 The Market Mechanism.............................................................................................. 44 A.5 Analytical Modeling Vs. Simulations .................................................................. 45 A.6 Software Engineering Aspects of Market Oriented Systems ............................... 45 A.7 Conclusion ............................................................................................................ 46 Appendix B – Proof of Lemma 1 ........................................................................ 47 References ............................................................................................................. 51 5 Chapter 1 – Introduction There 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, especially due to the influence of the work on “Network of Workstations” [1]. There are several added complications, though, in the global case of cooperation over the whole Internet. First, there are major technical difficulties due to code mobility, security, platform heterogeneity, and coordination 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 a global computing system. The POPCORN system provides an infrastructure for such “global computation”, addressing all these difficulties. It has been implemented in Java™ [2] and may be used over the Internet through its web site [3]. Descriptions of the system can be found in [4, 5, 6, 7]. This work focuses on POPCORN’s approach to the last issue, that of motivating cooperation. The POPCORN system provides an online electronic market for trade in CPUtime. Buyers and sellers of CPU-time connect to it via the Internet, and the market matches buyers and sellers according 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 totally automated 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 and understood. The design and implementation of such online electronic markets will of course draw on the vast literature available regarding real-world markets [8, 9, 10, 11, 12, 13, 14, 15]. However, one should note that 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. We hope that our experiences with the POPCORN market may shed further light on several aspects of online electronic markets. 1.1 The POPCORN System – Global Computation over the Internet 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 Internet that 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. 6 There are three distinct entities in the POPCORN system: 1. The parallel program written (in Java) using the POPCORN paradigm and API. This program acts as a CPU-time “buyer”. The programming paradigm was 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 buyers and sellers of CPU-time. The buyer program, using the POPCORN programming paradigm, achieves parallelism by concurrently spawning off many sub-computations, termed “computelets”. The POPCORN system automatically sends these computelets to a market (chosen by the user), which then forwards them to connected CPU-time sellers, who execute them and return the results. The matching of buyers and sellers in the market is dynamic, is done according to economic mechanisms, and results in a payment of the buyer to the seller. The system is clearly intended for very coarse-grained parallelism. The efficiency is mostly determined by the ratio between the computation time of computelets to the communication effort needed to send them and handle the overhead. To achieve high efficiency, computelets should be relatively heavy in terms of computation time. Currently, seconds of CPU-time per computelet are a minimum, and tens of seconds seem more typical. For very large-scale computations, even hours 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 such sub-computation is executed asynchronously on some remote processor. A “Computelet” object encapsulates 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: it includes both the code to be executed as well as the data that this code operates on. The computelet is constructed at the local host, is sent to a remote host, and a pre-specified method gets 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 the computelet; an object termed a “Computation Packet”. The heart of a computation packet is indeed the computelet that executes its main function. However, the computation packet encapsulates in addition all information regarding the local processing of this computelet: How it is constructed, the price offered for it, how it is handled locally when the answer arrives, how it is verified, what happens if the remote computation fails somehow, etc. When a computelets’ result arrives, 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 may currently be used on the POPCORN market web site [3]. Further, and continually updated information can be found on the POPCORN web site [5]. 1.2 A Micro-Economy of CPU time If 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 ranging to real cash payments. In any case, any general enough mechanism will result in what 7 may be clearly 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. 1.2.1 The Goods The 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 uniform types of goods with a larger market size. Our approach has been to emphasize uniformity in the initial implementation, but building the infrastructure to allow specialization in later versions (with hopefully larger market activity.) Our basic goods are the “JOPs” – Java Operations. This is the Java equivalent of the commonly used, though imprecise, FLOPS. Of course, there are different types of Java operations, 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 actually took 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 is reported back to the market. 1.2.2 The Money One 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 abstract notion 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 current implementation, 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]. Each user 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 financial aspects throughout the computation. Once this mechanism exists, all of the motivations described above 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, just ignore 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 time A 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’ return of 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 8 offer. The contract specifies the prices offered, whether the price is per computelet or per JOP, and the market mechanism required for this transaction (see below). The contract may be hardcoded 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 repeatedly receives computelets and computes them. In the most direct form, a seller visits the market’s web site, where he is asked to provide his account information (name and password). Once this information 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 the trade, 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 to him. In addition to this interesting information, the page contains the “POPCORN logo”. This logo has two main functions. First, the logo is an applet that receives computelets and executes them. 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-line game, 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 “interesting” online information may get, in effect, paid for this information with popcoins, and become, what we 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 popcoins earned 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 gets information; 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. 9 1.2.4 The Market The 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 be many different markets, but supposedly, each is in a “well-known” location. Obviously, this makes the market a bottleneck of the entire system, but as long as the computation done by each computelet is CPU-time-consuming enough relative to the market overhead, a single market can handle large numbers of buyers and sellers. The market is a trusted intermediary and is responsible for matching buyers and sellers, for moving the computelets and results between them, as well as for handling all payments and accounts. The implementation of the market involves 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 important aspect of the market is to match buyers and sellers according to economic criteria. We have three different auction mechanisms currently available [20, 21, 22]. They are handled as separate internal markets and each buyer and seller chooses the desired mechanism (in addition to choosing whether the payment is per JOP or per computelet). The first mechanism is the repeated Vickrey auction [23] (i.e. multiple rounds of the Vickrey auction). 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 are represented at the market by brokers that act on their behalf). 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. In this case, the seller may specify an 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, buyers and sellers submit a low price, a high price, and possibly a rate of change. The sellers start with an 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 very dynamic and easy to define and implement. The third mechanism we provide is a repeated clearinghouse double auction [24]. This mechanism is very similar to the previous one, except that in each round more than one buyerseller pair is matched. A single price is used for all the transactions of a given round. 10 Figure 1.3 (right): A snapshot of connections to the market. 1.3 Market Analysis From 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 and communicational complexity of the mechanisms. The most important computational issue in the Internet 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 mechanism’s allocation is socially optimal, subject to very restrictive assumptions about the environment. We also show that when some of the assumptions are dropped, 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 are satisfied with informal discussion and simulations. Simulations show that the mechanism is “quite efficient”. We found that the social efficiency of the allocation depends on the relative intensity of buyers’ and sellers’ orders. As the sellers/buyers ratio grows, the efficiency of the allocation decreases. Overall, our simulation results support the use of the simple double auction as a POPCORN mechanism. Our main result for the repeated clearinghouse mechanism is that it is extremely efficient, and therefore suitable to use as a POPCORN market mechanism. We rely on the literature that provides evidence for the mechanism’s efficiency. We do not carry out a complete efficiency analysis for this mechanism and we use simulations instead. Simulations show that the mechanism is very efficient, when it is compared to the optimal offline allocation. We found that the 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 the volatility 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 the least stable mechanism. 11 These results and the discussion in the following chapters lead us to the conclusion that among our suggested mechanisms, the clearinghouse double auction is the most appropriate for our environment. In addition to the economic analysis, we analyze the algorithmic and communicational complexity of these mechanisms and show that they are quite low. We also describe the economic-infrastructure architecture from a software-engineering point of view and explain its modularity, flexibility, and scalability. We explain how the use of contracts and brokers minimizes communications, reduces the complexity of the software, and contributes to the flexibility of the system. 1.4 Main Results This 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 used in the future developments of online markets. A framework for evaluating computational market-based systems is developed. We feel that 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 proposed framework. In particular we find that the clearinghouse double auction is superior to the other mechanisms in the context of online markets for CPU time. Our results may be generalized to other, non-CPU markets, assuming that some conditions hold in the new environments. 1.5 Thesis Structure Chapter 2 deals with the modeling and the formal analysis of the various markets. The analysis is partial and many questions remain open. Some of these questions are answered by simulations, which are the topic of chapter 3. Chapter 4 describes the architecture of POPCORN’s economic infrastructure. Chapter 5 outlines directions of further research. Appendix A provides a survey of related economic-oriented works in computer science. 12 Chapter 2 – Towards an Analysis of the POPCORN Markets 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 important when 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 information available to the players. Some results from game theory and mechanism design literature [25] are directly or indirectly applicable, yielding both positive and negative results. The trade in a given market is governed by a market institution一 - a term that refers to a set of rules that specify the set of legitimate messages among the traders, how and when the traders transact, the goods that are being traded, etc. One way of analyzing a POPCORN market is to view 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 future rounds. Each trade-round at the market corresponds to one round in the game. The players of the game are the selfish buyers and the sellers, who seek to maximize their private utility. The game is a game of incomplete information [26] because the players do not know their opponents’ utility functions二. The game that fully corresponds to the POPCORN trade is difficult to analyze formally, and therefore we make some simplifying assumptions in our discussion below三. The analysis 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 the mechanisms in their repeated form, we assume that buyers and sellers are truthtellers. We use economic criterions for telling a ‘good’ mechanism from a ‘bad’ one. Our main interest 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. In order to calculate the total welfare that is generated by an allocation, i.e. we sum up the utilities that each agent gains from this particular allocation. We use a criterion known as the compensation 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 reallocation of x over the allocation x . If there does not exist any allocation that is potentially Pareto preferred to the mechanism’s allocation then the welfare of the economy is at its maximal value四. In its general form, the Popcorn good can be defined as the right to compute subject to some agreed 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 buyer’s utility is gained from higher level entities than JOPs but we assume that the buyer’s utility is gained directly from the JOPs. Similarly, we assume that the seller’s utility stems from his profits in Popcoins. Therefore, when the per-JOP scheme is used, we expect the market price of this good to reflect both the cost of producing it (by sellers) and its social value (to 一 We use the terms “market institution” and “market mechanism” interchangeably. 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. 三 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. 四 This criterion is different from other criteria for evaluating scheduling mechanisms. We’re not interested in the minimization of objective functions like, makespan, total waiting time, total flow time etc. [52], and we’re not dealing here with a central planner seeking to minimize one of these objectives. 二 13 buyers)一. Furthermore, it can be shown that when this is not the case, the society’s welfare is not maximized and the allocations are not efficient [14]. The scheduling of computelets is nonpreemptive 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 by their 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 Vi 0 , drawn from some probability distribution F . The buyer’s type represents his valuation of a JOP at time 0, and once a buyer’s type was determined at time 0, his valuation of a JOP (in terms of time 0) decays as the calculation of that JOP is done further into the future. Formally, buyer i ’s valuation of the calculation of a JOP at period t in terms of period 0 is Vi t tVi 0 , where Vi 0 is i ’s type, and 0 1 is a discount factor that is common for all buyers. We also assume that if a buyer cuts a deal at time t , and buys a computation of L jops , at a price p , he enjoys a utility of L(Vi t p) . 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 ei , drawn from some probability distribution G . The seller’s type is his expenses per a unit of time. Another attribute of the seller is his machine’s speed of zi jops second . The speed is drawn from some probability distribution H . We assume that if a seller cuts a deal to sell a computation of e L jops , at a price p , he enjoys a utility of L( p ) . Therefore, our sellers are risk neutral too. z A seller generates a stream of orders, beginning with a ‘connect’ order, followed by at least one ‘ask’ orders, 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 market’s trade activity. An active buyer can not act as an active seller at the same time. The same holds for an active seller. Unless stated otherwise, we assume that, The sum paid by the winner to the seller is equal to c * p , where c denotes the number of JOPs comprising the packet, and p denotes the price per JOP set by the auction mechanism. Buyers and sellers don’t know the number of their competitors. The bids (asks) are fixed throughout a single auction round but may change between rounds. The seller’s broker publishes no information about his client’s computer. The auctions rounds are held in fixed time intervals of d seconds. Each round consumes zero units of time to execute. 一 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 would face a POPCORN variant of the “tragedy of the commons” [ 14 46] in the CPU time resource. 2.1 The Repeated Vickrey Auction Mechanism The 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 equals the 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 turn of the next broker to hold a Vickrey auction is based on his client’s arrival time at the market. 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: All the sellers’ machines are identical with a speed of z jops 1. . The sellers’ second expenses for a unit of time e are the same for all sellers. Hence, the various sellers are identical in every aspect that is relevant to our discussion, including the points in time when they connect and disconnect. They can be thought of as multiple “copies” of some given 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 points in 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 Round A 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 pays does not depend on his own bid一. We also note that the Vickrey auction belongs to a special kind of 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 by the 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 V jt . Therefore the seller’s per-second profits from the deal are zV jt e . The buyer’s per-second gains would be z(Vi t V jt ) . Thus, the “per-second social surplus” from the deal chosen by the mechanism (which equals zVi t e ) is the maximum possible “per-second social surplus” on all possible deals among all active sellers and buyers at this particular round. We assumed that the sizes of the packets are equal and so the auction maximizes the social surplus in each round. 一 This property only holds if we assume that the players know their types, and that the seller is committed to sell if a buyer is found. More information about the importance of commitment can be found in [27]. 15 2.1.2 Multiple Auction Rounds However, 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 do not know of practical ways by which programs can gainfully employ strategic reasoning in the context 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: Assume that the players are non-strategic and that mechanism was run on some given finite input stream of orders received from the buyers and sellers. Denote by x ( x0 , , x r ) the allocation chosen by the basic mechanism in its r * d seconds of execution, where, i xk 0 if buyer i was scheduled to execute at time k * d if no buyer was scheduled to execute at time k * d Note that the beginning of the allocation process is at time 0, and that the auction rounds are held at discrete points. We’re not stating which seller sold to which buyer, since we assumed that the sellers are all identical. We are interested in checking if this allocation is maximizing the welfare of the economy. To check 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 the input 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 from lemma 1 that the allocation chosen by the mechanism is maximizing the welfare of the economy. 2.1.3 Relaxing Some Assumptions The 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 from this 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 that the mechanism’s allocations are not so far from being efficient, but we have not carried out such an analysis. A situation similar to the one we’re dealing with, in which many goods are sequentially sold in one-sided auctions, is seldom analyzed in general settings due to its complexity. Furthermore, the existing theoretical and experimental studies show that in the general 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 is relaxed. 16 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 to another 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 sections the effect of heterogeneous costs. When introducing sellers with different speeds the previous lemma is no longer valid. The reason 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 to hold an auction. As a trivial counterexample, consider the case where there are two buyers, B1 , B2 , each buyer wants to buy one packet and two sellers S1 , S 2 . Assume that V10 100 popcoins , V20 50 popcoins , 0.9 , z1 100 jops sec , z2 50 jops . Assume also sec that both of the sellers have connected to the market before the buyers, and that S 2 has connected before S1 . In this case, the mechanism will match B1 with S 2 and B2 with S1 . The total gains from trade in this case would be W 0.92 * 100 0.91/ 2 * 50 128.4 . However, had the mechanism has chosen to match B1 with S1 and B2 with S 2 the total gains from trade would have been W 0.9 *100 0.9 * 50 135 . Note that this problem would not exist if we assume that the buyers’ valuation 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 his computations on his own machine, no matter how long it takes… Sorting the available sellers according to their computer speeds instead of sorting them according to their arrival time does not solve our problem. The resulting revised mechanism is a greedy online algorithm, which maximizes the per-second gains from trade over the possible deals in every round of its execution. The gains from trade in every round equal z *Vi t e* , where e* is the expense-per-second of the fastest seller, z * is this seller’s speed, and i is the winning buyer. Such a mechanism is not optimal. A counter-example, in which the mechanism’s allocation is inferior to another allocation, can be constructed but we do not bring it here. An interesting question is weather this algorithm is competitive [31] with respect to the possible gains from trade, given a set of buyers and sellers一. 2.1.3.2 Heterogeneous Sellers (various production costs) Let J {1,2,3..., m} , be the group of sellers, and let I {1,2,3,..., n} , be the group of symmetrical buyers. Let q , denote the number of identical packets to be computed by these q buyers. To keep everything simple, assume that is a natural number for all l {1,2,..., m} and l that auctions of two available sellers are held at almost the same time. Denote by e j the persecond costs of seller j . We assume without loss of generality that e1 e2 em , and V10 V20 Vn0 . In the presence of various production costs on the seller’s side, the optimal allocation solves the problem: 一 One conclusion from this discussion is that if the group of sellers is heterogeneous then the buyers should be informed of the sellers’ speed. Otherwise, the resulting allocation would not be efficient. 17 q 1 j max jJ i j 0 ek L Vk z i 0 k 1 . Note that the number of buyers is not important in this case (only the total number of packets is important). 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, it would not be sufficient. For example consider the simple case where J {1,2,3,4,5} , e j j I {1,2} , q 120 , V10 V20 10 popcoins , L 1 jops , z 1 jops . If 0.9 , jops sec we get that the social gains from trade is maximized when using all of the machines. Our mechanism would have chosen the same allocation. When 0.99 , 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 resulting mechanism 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) were independently 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 a dominant 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 a game of incomplete information, the Vickrey auction has Bayesian-Nash equilibrium and that the mechanism is a direct-revelation mechanism, for both the buyers and the seller. Finally, they prove that the mechanism’s allocation is ex-ante efficient. It follows from their work that the seller has an incentive to report his computer true speed, even when the system does not enforce this behavior. Milgrom and Weber’s analysis only addresses a single round and we still need to check if the global allocation is also efficient. It turns out that it isn’t. We do not bring a counter example here, and only say that, again, the reason for this is that there is no competition among the sellers and their turns are determined arbitrarily. We don’t know weather sorting the sellers in some other way would make the allocation ex-ante efficient or competitive一. 2.1.3.4 Asymmetric Buyers As was the case against identical sellers, when we deal with the Internet environment, it seems not realistic to assume symmetry among the various participating buyers. Computer prices vary from one location to another, the ‘typical’ computer is different, etc. We have assumed that the buyers valuations were independently drawn from the same distribution F . However, it turns out that lemma 1 can also be proven for the case of various distributions. 一 Note also that when we drop the independent-private-value model, the question weather buyers know the number of their competitors becomes important. 18 Therefore, all that’s 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 the general case, the various buyers would possess q packets with sizes c1 , c2 , , cq , with bids b1 , b2 , bq 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, S1 , 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, B1 , possess a packet with size c1 1 jops and with a bid p1 V10 100 popcoins . The second buyer, B2 , possess a packet with size with cs 2 jops and with a bid p2 V20 101popcoins . Assume 0.9 , and z 1 jops sec . The mechanism will match B2 with S1 first. When the computation of the packet is finished, B1 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 a computelet returns) make the length of the packet important. 2.2 The Double Auction Mechanisms We 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 not introduce 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 every round of the repeated auction, the highest bidder is matched to the lowest ‘asker’(unless the seller’s ask is higher than the buyer’s bid). The winning buyer pays to the winning seller an amount that is equal to the average of their offers. The buyers’ and sellers’ offers may change across 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 Vickrey auction, 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 dominant strategy 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 necessarily report their true valuations (utility-maximizing players are now strategic and honesty isn’t the best policy). Since at equilibrium, buyers and sellers shade their bids and asks, a seller’s ask may be higher than all of the buyers’ bids, while a buyer, whose valuation for the good is higher than that of the owner, exists. Furthermore, each round of the mechanism only allocates a single good and we prefer mechanisms that allocate more than a single good in each round because this decreases the overhead and the price variability. We return to the mechanism in the simulations section. 19 2.2.2 The Clearinghouse Double Auction The 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 uses the resulting “Marshallian cross” to decide on a price and quantity for trading. The intersection of the two curves defines the trading price, p0 . Buyers who bid more than p0 trade with sellers who ask for less than p0 and the market is cleared. Most of the characteristics of the simple double auction apply here, too. The exceptions are the price determination rule and the fact that more than one buyer-seller pair may trade in each round. The clearing price p0 in each round is determined as follows. The buyers’ bids are written in descending order, V(1) V( 2 ) V( n ) . The sellers ask-prices are written in ascending order, A(1) A( 2 ) A( m ) . We add a fictitious bid, Vn1 0 , and a fictitious ask, Am1 . The mechanism then looks for the first pair (V( j 1) , A( j 1) ) satisfying A( j 1) V( j 1) . The traded 1 1 (V j A j ) (i.e. we use k-DA with k ). 2 2 Figure 2.1 below shows how the price and quantity are determined. quantity is then j , and the clearing price is p0 Price Supply Vj Aj p0 Aj Demand Q0 j Packets 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 and commodities 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 buyer’s (seller’s) type was determined at time 0, his valuation remains constant 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 k 1 2 . The gains from trade for the given the demand and supply curves are shown in figure 2.2 by the shaded area. The shaded area, is comprised of two triangles. The upper triangle, G B , represents the total buyers’ gains and the lower triangle, G S , represents the total sellers’ gains. 20 Figure 2.2: The gains from trade Each buyer (seller) has some influence on the expected price p0 , therefore he has an incentive to shade his bid (ask). Consequently, the reported demand curve is lower than the honest-reporting demand curve. Similarly, the reported supply curve is higher than the honestreporting 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 criterion of Bayesian Nash equilibrium (a very similar double auction mechanism, with dominant strategies for both buyers and sellers exists [37], but the mechanism is a bit more complicated). The calculations 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 types diminishes, and the gains from trade converge to the maximal possible value. Formally, RSW assume that the buyers’ and sellers’ types are drawn from probability distributions F and G respectively. Denote a buyer i ’s type by vi and seller j ’s type by a j . The buyer’s bid Vi and the seller’s ask A j are conditioned on vi and a j , 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 that the misrepresentations measured by vi Vi and Ai ai are O(1 (m n)) , where m and n are the number of buyers and sellers respectively. The gains from trade realized by the auction is then, v a iTB i iTS i , where, TB , TS are the sets of trading buyers and sellers respectively. RSW then define expected gains from trade as the expected 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 each trader honestly reported his type instead of strategically reporting some other value. The relative efficiency 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 21 relative efficiency of the equilibrium is at least 1 . Hence, they show that within a (m n) 2 constrained environment, the result of the k-DA is close to the classical full information optimal allocation一. 2.2.2.2 Multiple rounds of the k-DA As was the case for the Vickrey auction, more complications result from the multiplerounds nature 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 RSW’s theoretical results, which no longer hold precisely [38]. The fact that multiple rounds are executed could result in inefficient results, when the mechanism is executed against an adversary who seeks 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 scenario’s execution, N 2 buyers register orders. Buyer i ’s true valuation is M i where M N 2 . During the scenario’s execution, N sellers register orders, and seller i ’s true cost is M 1 i . The mechanism is executed for N * T seconds. Every T seconds a kDA round is held. T 5 . We assume that the buyers’ valuations are constant over time, and the same holds for the sellers’ costs. Each buyer wants to buy the computation of a single computelet, and each seller connects to the market, sells one computation and then disconnects. We assume that the agents report their true valuations and costs. Buyer i and seller i register their orders at time 1 (i 1) * T . 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 G N . Let Q N / 2 . Q However, the maximal (offline) gains from trade are G 2 * i Q . i Mendelson [39] analyzes a repeated clearinghouse mechanism, quite similar to the repeated kDA mechanism. The difference is that Mendelson’s mechanism does not specify how a clearing price is chosen among the possible clearing prices in the interval [V j , A j ] . Most of his results are not affected by this choice. Mendelson’s main assumptions are that the bids and asks are uniformly distributed over some interval [0, m ] , and that the arrival of orders from buyers and sellers are governed by identical Poisson processes with rates m ( is some constant). He shows 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 the expected number of buy (or sell) orders per price unit. He calls “the order intensity”. One important feature of Mendelson’s 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-DA round 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, 一 McAffee [37] shows that transforming the mechanism by dropping the last trading pair and determining that buyers pay V j , and sellers earn A j , 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 gains from trade in this new mechanism are also O(1 (m n) 2 ) . 22 the clearing price p0 is an unbiased estimator of the “true” underlying price. By “true”, we mean the price resulting from intersecting the expected supply and demand curves. var( p0 ) m 1 (1 e 2 m )( 3 e 2 m ) 8 322 The variance of p0 is a decreasing function of . Also, as , the variance of p0 approaches zero very quickly. Since T , increasing T will decrease the variance of p0 . The facts that E[ p0 ] m , and that the variance of p0 decreases quickly as (or T ) 2 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 Mendelson’s assumptions. The number of connections to our system is much too low for that purpose. 23 Chapter 3 – Simulating the POPCORN Trade In this section, we check the market’s behavior and characteristics by simulating the trade that results from the dynamic arrival and departure of various buyers and sellers. There are many empirically open questions, of which we consider only a few. Perhaps the most interesting issues are the allocation’s efficiency in a dynamic environment and the price response to supply and demand shocks. In addition, we check the markets adaptivity and the relation between a seller’s (or buyer’s) 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 a single computelet to compute, and each seller wishes to compute a single computelet. In some simulations 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 simple settings 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 the economy’s adaptation is quite high, the prices are relatively stable, and reservation prices have the expected effect. 3.1 A Test-bed for Carrying out the Market Simulations In 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 the trade. Figure 3.1, below, is a schematic description of the simulation test-bed architecture. The Popcorn Market Market Adapter A Simulated Buyer Contract Simulation Properties Market Trade Simulator Computelets Events Simulated Buyers Agents Factory Simulated Sellers Buyers Connections Sellers Events Generator Connections Events Generator A Simulated Seller Contract Simulation Properties Figure 3.1: the simulations test-bed architecture The hart of the simulation test-bed is a Market Simulator object, which coordinates among the various simulation objects. The Market Simulator is connected to the POPCORN market through a 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 having to worry about communication bottlenecks (which exist in the communication layer). 24 The Market Simulator is an observer of an Agents Factory, whose responsibility it is to create new buyers and sellers (we use Java’s built in Model-View paradigm [40], where an object registers itself as an observer of another observable object). The Agent Factory observes two events generators: a Buyers Creation Events Generator and a Sellers Creation Events Generator, which generate the buyer and seller creation events, respectively. The generators generate stochastic processes of some kind. We have experimented with 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 external files. The Agent Factory creates objects of type Simulated Buyers and Simulated Sellers. These objects 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 to the traded good and his bid characteristics are externally configurable this way. Another example is the Simulated Seller’s “machine characteristics” (e.g. its CPU speed). Most of the parameters that 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 Simulated Computelet size (in JOPs) is determined by its owning buyer. When such a computelet reaches a Simulated Seller, it is informed of the seller’s machine speed and as the computelet’s “compute” method is invoked, it goes to sleep for the appropriate time period. 3.1.1 Simulated Buyers One 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 part of 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 probability distributions. 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 buyer’s valuation determines the possible (rational) strategies, and each one of the possible strategies can be chosen. This strategy is defined by his open bid, bid increment rate, and maximum bid. The type of market mechanism, which the buyer wishes to use, is fixed throughout the simulation. A buyer quits the system, after all of his computelets’ results have returned. 3.1.2 Simulated Sellers Simulated 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. The selling strategy is similar to the buyer’s buying strategy, and is defined by the seller’s contract. The seller’s machine speed and lifetime period are drawn from uniform distributions. 3.2 Simulations and Results 3.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 holding the 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 to compute a single packet of random size and each seller wishes to compute a single packet. All 25 the sellers machines speeds are identical. Buyers packets valuations and the sellers costs are drawn uniformly from the interval [0,30] . Buyers and sellers arrivals are governed by different Poisson processes. The Poisson process that determines the arrival of buyers remains constant throughout the 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 the changes in the supply. We have run about forty simulations for each mechanism, three times for each value of the supply process lambda. All of the results that we bring next are based on measurements that were made during a steady state phase (i.e. when the percent of fulfilled requests out of the total number 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. 0.80 Fulfilled Requests / Total Requests Fulfilled Requests / Total Requests 0.80 0.70 0.60 0.50 0.40 0.30 0.20 0.10 0.00 0.00 500.00 1000.00 1500.00 0.70 0.60 0.50 0.40 0.30 0.20 0.10 0.00 0.00 2000.00 200.00 400.00 600.00 800.00 1000.00 1200.00 1400.00 1600.00 1800.00 Time (seconds) Time (seconds) 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 price information 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 resulting average price at steady state. 30 25 Price (popcoins) 20 Vickrey Auction Simple Double Auction Clearing House 15 10 5 0 0% 10% 20% 30% 40% 50% 60% 70% 80% 90% 100% Percent Of Buyers Fulfilled Requests Figure 3.4: prices under different buyer/seller ratios In general, these results comply with our expectations, regarding the behavior of prices. It is evident 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 26 results 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 a different 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 the optimal-offline mechanism. That is, we compare the generated welfare of POPCORN’s online mechanisms to that generated by a perfect mechanism that, in advance, has all the information about the buyers’ and sellers’ orders. The quotient of these two numbers represents the relative efficiency of the mechanism. This comparison is not “fair” towards the POPCORN online mechanisms. They should be compared with the best online mechanism that bases its decisions on exactly the same information that is available at runtime [41]. Nevertheless, comparing our mechanisms’ allocations with the optimal offline allocations is still enlightening. 100% 90% 80% Efficiency (%) 70% 60% Vickrey Auction Simple Double Auction Clearing House 50% 40% 30% 20% 10% 0% 0% 10% 20% 30% 40% 50% 60% 70% 80% 90% 100% Percent Of Buyers' Fulfilled Requests Figure 3.5: economic efficiency under different buyer/seller ratios Figure 3.5 shows that although we compare our mechanisms to an optimal offline mechanism their relative efficiency is quite high. In the case of the clearinghouse mechanism, it is very high with the average of 96% (!). We also see that the simple double auction and Vickrey do not achieve such good results. The source of this difference is sellers with high costs that are matched to buyers instead of sellers with lower costs, who have not reached the market yet (recall the example 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 the clearinghouse results, since with this mechanism, the trade is executed in round within fixed intervals. We also verify by simulation that our result from chapter 3 for the Vickrey auction with homogeneous sellers holds (figure 3.6). The average efficiency in this case is 98% . The slight loss in the efficiency was a result of a bug in our implementation that caused some of the packets to be lost sometimes… 27 100% 90% 80% Efficiency 70% 60% 50% 40% 30% 20% 10% 0% 0% 10% 20% 30% 40% 50% 60% 70% 80% Number of Fulfilled Requests / Total Number of Requests Figure 3.6: economic efficiency under different buyer/seller ratios in the repeated Vickrey auction with homogeneous sellers 3.2.3 Prices Stability For 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 the quotient in the clearinghouse market is 0.147 , and in the simple double auction, it is 0.33 . Thus, the clearinghouse is much more stable. Figures 3.7, 3.8, 3.9, below show the price behavior in a typical run of each of the three mechanisms. 30.00 35.00 Price (popcoins) 25.00 25.00 20.00 15.00 10.00 0.00 0.00 20.00 15.00 10.00 5.00 5.00 500.00 1000.00 1500.00 0.00 0.00 2000.00 200.00 400.00 Time (seconds) 600.00 800.00 30.00 25.00 20.00 15.00 10.00 5.00 0.00 0.00 1000.00 Time (seconds) 35.00 Price (popcoins) Price (popcoins) 30.00 200.00 400.00 600.00 800.00 1000.00 1200.00 1400.00 1600.00 Time (seconds) 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 28 1200.00 1400.00 3.2.4 Market Adaptation In 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 thorough investigation 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 5 8 minutes of simulation. This period is the same for all levels of supply and across the various markets. 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 and figures 3.10, 3.11 depict this property for the clearinghouse market. Note that buy offers that are lower than a certain threshold, or asks that are higher than a threshold, never execute. We obtained similar results for the repeated Vickrey auction and the simple double auction. 0.08 0.10 0.09 0.07 0.08 0.06 Probability to Sell Probability to Buy 0.07 0.06 0.05 0.04 0.05 0.04 0.03 0.03 0.02 0.02 0.01 0.01 0.00 0.00 5.00 10.00 15.00 20.00 25.00 0.00 0.00 30.00 Buyer Offer 5.00 10.00 15.00 20.00 25.00 30.00 Seller's Ask 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 Properties In 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 same results 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 remain unanswered. Our early experiments with strategic buyers and sellers, who shade their bids and asks 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. 29 Chapter 4 – The Architecture of POPCORN’s Economic Infrastructure We now describe the architecture of POPCORN’s economic sub-system. We describe the various POPCORN entities that are related to the economic infrastructure. Technically these entities are implemented as Java objects, but we do not get into implementation details like inheritance 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 language’s constructs. We can envision a different implementation of some of these entities as CORBA [42] or C++ [43] objects and the same architecture would still apply. We also explain the consequences of the chosen architecture. 4.1 Contracts The 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 market’s database across sessions and be used as the default contract, when no other contract is supplied. In the current implementation, there are two general types of contracts: A buyer contract, which describes the rights and obligations of a POPCORN buyer and a seller contract, which does the same thing for a POPCORN seller. The contract is consisted of sections, and each of these sections describes an aspect of the bond. 4.1.1 The Buyer Contract The most important section of the buyer contract is the part that defines the buyer’s bid. The bid defines the buyer’s current offer for the good that he wants to buy. This offer may change over time, and the manner in which it changes, is defined by the bid. The “means of payment” section defines how the buyer wishes to pay. At the time of writing these lines, the only acceptable 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 available mechanisms. 4.1.2 The Seller Contract The seller contract’s parallel of the bid section in the buyer contract, is the “ask”. The ask defines the seller’s current demand for the good that he is offering to sell. This ask price may change 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 desired trade mechanisms. These sections have the same meaning as the corresponding sections in the buyer contract. 4.1.3 Defining the Contracts The 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 figure 4.1). The tool is part of the “Buyer Environment Configuration” tool. The buyer can “attach” a contract to a specific computation packet, or alternatively use a single contract for an arbitrary group 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. 30 Figure 4.1 (left): visually manipulating a buyer’s contract (the buyer environment application). Figure 4.2 (right): visually manipulating a seller’s contract (the seller administration applet). 4.1.4 Consequences The 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 current implementation, 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 substantial modifications. General contracts could provide the functionality of software-agents’ trade within the market, without the security complications. The brokers, in this case, serve as the agents, “executing” the contracts’ instructions. Contracts decrease the system’s communication overhead and 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 the same contract, there is no reason to send the contract with every packet, and the contract could be cached in the market by the client’s broker. Contracts are also used to resolve conflicts between buyers and sellers. A “judge” mechanism is being developed for this purpose, and will become an integral part of the POPCORN system [16]. 4.2 Market Structure The 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 one market 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 a clerk sitting at a desk by the entrance, and through him everything is entering and leaving the market. The registry “talks” with the lower-level communication module. Packets are directed by the registry to the market logic. Administration orders are 31 directed by the registry to the accountant. The market registry interface is defined in the Java interface popcorn.market.MarketRegistryInterface 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 and sellers. It also provides account administration services. The accountant interface is defined in the Java interface popcorn.market.AccountantInterface Market Logic - this interface defines the part of the market that is responsible for the matching of sellers and buyers. The registry passes the packets it gets from the outside world to the 'market logic' module, which matches the arriving packets with pending sellers. 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 logic interface is defined by the Java interface popcorn.market.MarketLogicInterface Market Monitor - the market-monitoring module is responsible for monitoring what's going on in the market. This includes (but is not limited to) the monitoring of prices fluctuations, deals throughput, connections for buyers and sellers, etc. The market monitor interface is defined by the Java interface popcorn.market.MarketMonitorInterface Postman - the postman is the market entity, through which high-level messages are delivered to the various market entities. Each entity, which cares to receive “mail” from outside the market, registers itself at the postman. This service is high-level, and has nothing to do with the low-level communication modules. The postman interface is defined 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 Module One 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 version of 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 is used. 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 receives the computelets that were sent by his (buyer) client and “attempts” to buy the CPU time needed for their computation from seller brokers, according to the terms of the contract that was attached to the computelet. Similarly, the seller broker, “attempts” to sell his (seller) client’s free CPU time. A broker is aware of his client’s state (encapsulated in a ClientState object). For example, a seller broker knows the number (and identity) of the packets that were sent to his client, and that have not returned yet. The hart of a competitive market is a mechanism that enables the brokers' interaction. This mechanism is defined by the ComputationMatcherInterface. For example, the implementor of this interface may be an auction-house object that encapsulates an auction mechanism. 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 with 32 sellers, based on the information in the registered orders and on the auction rules. For each matched pair, the market initiates a deal for the buying and selling of CPU time. Each deal is represented by a Deal object, which encapsulates all the information about that deal. Each deal is executed in a separate thread, and is executed through the cooperation of the appropriate buyer and seller brokers. The buyer broker transfers the needed packets to the seller broker, and the accountant is informed of the deal, which results in the transfer of popcoins, and a logging of the deal. 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 Consequences The 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 in the number of goods that are being traded in it. To add a new good, we extend the standard contracts so that the agents could refer to that good in their contracts, and implement a new submarket for that good. The market’s computational and communicational complexities are also low: Normally, each arrival of an order to the market sums up to a few hash lookups, which is done in O (1) . An exception is the cancellation of an order, which demand for the cleaning up of the broker’s internal data structures. In the case of a buyer disconnection, this operation costs O (m ) , where m is the number of packets sent by that buyer. The disconnection of a seller is done in O (1) . The matching mechanisms are also efficient, and are generally implemented as priority queues of orders. The operation of registering a buyer (seller) order costs O (log n ) , where n is the number of buyers (sellers). The cost of an auction round is done in O (1) . The operation of updating all of the orders, based on the number of trading rounds costs O ( n log n ) , 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 the heap as we do. Benchmarks show that this implementation is not efficient enough for the simple double auction, when the number of buyers and sellers is very big. Our measurements show that the market spends much time in updating the heap of orders. This, in turn, causes the market to “lag” behind and the orders start to pile up. The problem can be solved in our case if we note that the strategies of buyers and sellers are represented by continuous functions. Thus, for the market to function it is sufficient that we keep track of the maximum envelope of the buyers’ functions and the minimum envelope of the sellers’ functions. Then, we do not have to constantly update the orders and when a new order arrives, we simply update the envelope. There are known efficient algorithms for calculating the envelope of a group of continuous functions [45], but we do not want to recalculate the envelope whenever a new order arrives. Hence, we need to implement a “clever and dynamic” heap, in which each node (a buyer or seller order) remembers the point in time when one of its children is expected to “pass” it (this calculation is easy because we deal with linear functions). When the moment comes, the nodes are switched and the new neighbors calculate the point in time when the next switch is expected. To add a new order, we perform normal heap insertion and as the new order reaches its place in the heap, it joins the same procedures. The heap maintains the property that the best offer is at the top. Due to time limitations, we have not implemented this data structure and we have not tested its impact on the market operation. 33 A design decision that has proven particularly beneficial, is the use a broker metaphor for representing the individual POPCORN agents at the market. It simplifies the internal market structure, and reduces the complexity that results from handling the various asynchronous events. When all the information about a client is kept in one place, it is easy to monitor the client’s remote and local state, and the recovery from errors is straightforward. The brokers can be viewed as simple software agents that on one hand execute their client’s programs (the contracts), and on the other hand are obliged to follow the market rules, and are constrained by the market environment. One negative property of the market is that it cannot easily be distributed. In the current architecture, the market is the communicational bottleneck of the POPCORN system. Benchmarks and profiling tests show that when the computelets were extremely short and arrived in huge numbers, the market’s machine spent most of its CPU time over the communication (in particular in Java’s Object-Serialization modules). The problems and solutions of the POPCORN communication modules are the subjects of another work [44]. One solution to the problem is the distribution of the market, which leads to the elimination of the bottleneck. Another solution is to implement a network of markets that can communicate and thus balance their loads. These solutions are beyond the scope of this work, and are the subject of ongoing research. 4.3 The POPCORN Seller Applet 4.3.1 Seller Structure The POPOCORN human seller doesn’t bother with the programming or the downloading of special purpose software. To become a POPCORN seller, it is sufficient to visit the POPCORN homepage [3] and register as a seller. After that, a Java applet is being downloaded to the seller’s browser, and this applet is responsible for the computation of the computelets and the resulting administrative work. In order to support the implementation of various types of sellers, the seller was also defined as a set of interacting interfaces: Seller Engine – this is the 'hart' of the seller. It coordinates between the seller parts and controls the computation of arriving computations. The seller engine may use its own thread scheduler that monitors the computations within the seller. The seller engine interface is defined by the Java interface popcorn.seller.SellerEngineInterface Seller UI – this interface defines the UI capabilities of and requirements from a seller application or applet. This interface defines the methods that are used by the seller engine to inform the status of the ongoing computations. The seller UI interface is defined by the Java interface popcorn.seller.SellerUIInterface Seller Communication – defines the low-level communication module of the seller. Like the market, the seller architecture is modular, easily modifiable, and extensible. Once we have completed the implementation of the first seller, the implementation of new types of sellers (for example, the logo applet of figure 1.2 in the introduction) had been very easy. 4.3.2 Per-JOP Payment Scheme Support One of the features that differentiate POPCORN‘s economic approach, from other similar systems, is the use of the per-JOP scheme. In chapter 2, we explain the importance of this 34 scheme for ensuring the efficiency of the allocation and in preventing a “tragedy of commons” [46] . To support the scheme, we monitor the execution of computelets on the seller’s machine. This is not a trivial task, because the human seller may use his machine for other nonPOPCORN tasks at the same time, and because we can’t turn to the operating system for help. The reason that we cannot get any help from the operating system is that we use Java as the underlying technology. Hence, the seller applet is executing within the Java virtual machine (JVM) [47], which protects the seller’s operating system from being directly accessed by the applet. Therefore, we are left with an approximation scheme for the number of JOPs that a computelet consumed. First, let us recall the definition of a JOP. In the introduction, its been said that “JOPs” stand for Java OPerations and that this is the Java equivalent of FLOPS. Since, there are different types of Java operations, with different costs in different implementations, we define a specific mix of computations and use this mix as a basis for our definition. The JOP definition states that a particular benchmark (the Eratosthenes sieve for finding prime numbers in a predefined interval) consumes X JOPs for completing, where X is a predefined integer. The idea is to compare each executing computelet against this benchmark. 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 actually took to compute remotely. A multithreaded operating system is called time slicing, if the CPU time is “sliced” among the executing threads [48, 49]. Each thread is given a change to execute for some time, and then it is preempted. The JVM uses the native threads of the operating system, on which it is implemented. Thus, the JVM may be time slicing on one system (e.g. the Windows 95 platform), and non-time-slicing on another (e.g. the Solaris 2.5 platform). Assume, for a moment, that the operating system, on which the seller applet is executed, is time slicing. We later consider the non-time-slicing case. The mechanism works as follows: When the seller engine is constructed, it creates a ComputeletMeter object. This object provides two functions: First, it allows other executing computelet threads to register themselves as active threads when they are activated, and to de-register themselves when they are stopped. The registration of a thread results in the opening of a record for that particular thread in the ComputeletMeter object. Second, the ComputeletMeter object encapsulates another special thread, which continuously executes the sieve benchmark, and after each round adds the number of JOPs consumed by that sieve round to the JOP count in the records of the active threads. In order not to waste resources, the thread within the ComputeletMeter only executes when there are other active computelet threads. When a computelet arrives at the seller, a new ComputeletThread object is created, this new object registers itself at the ComputeletMeter, it then computes the computelet, and when its done, it de-registers itself at the ComputeletMeter. All the threads execute with the same priority. Thus, on a time slicing JVM, the various threads get (on average) the same amount of CPU, and the mechanism correctly estimates the number of JOPs consumed by the computelets (assuming they are big enough). This property holds independently of what the user is doing with his machine during that time! Thus, the user cannot fool the mechanism to think that his computer worked for a long period by loading it with non-POPCORN tasks, as would have been the case, if a time-based mechanism was used. Furthermore, the mechanism is insensitive to the number of concurrently executing threads. Therefore, it can also be used on a multiprocessor machine. The relative overhead of executing the monitoring thread decreases, as the number of concurrently executing computelet-threads increases. 35 All that’s been said in the previous paragraph only holds for a time-slicing JVM. On a nontime-slicing JVM the benchmark thread would starve the other threads and they wouldnever execute. The solution is to somehow implement a different threads scheduler, which emulates a time slicing scheduler: In addition to all of the previously mentioned threads, yet another thread is used. This thread executes with a higher priority than all of the other threads, but spends most of its lifetime sleeping. The Java thread priority definition states that “when there is competition for processing resources, threads with higher priority are generally executed in preference to threads with lower priority” [49]. This is not accurate for a time slicing JVM, but we are now interested in a non-time-slicing situation. Thus, whenever the high priority thread “wakes up”, it is scheduled to work, and the currently executing thread, call it A , is preempted. The high priority thread than immediately goes to sleep, and another thread, different from A , is scheduled to work. Thus, we emulate a time slicing scheduler on a non-time-slicing JVM, and all that’s been said about the monitoring of threads on time slicing JVM, now holds for a non-time-slicing JVM, too. When the seller applet downloads into the browser, it first checks, which type of operating system is running on the seller machine and then “decides” if it needs to emulate a time slicing scheduler for the JVM. The monitoring mechanism has one more important role: It can detect computelets that execute “indefinitely” and when such a computelet is detected (it consumed more than a predefined amount of JOPs), its execution is terminated, and a suitable exception is be passed to the buyer. One potential problem with the benchmark approach is that a dishonest seller may alter his browser in such a way that will cause the benchmark mechanism to report false values. Some of the techniques used for the verification of the results of a computelet [16] may be used for verifying the benchmark values. For example, contrasting of benchmark results from different sellers, spot checks by the market, etc. In addition, the enforcement mechanism, developed in [16] may also be used for enforcing the honest benchmark reports. See [16] for more information about verification and enforcement issues in POPCORN. 36 Chapter 5 – Directions for Further Research We divide the possible further research in this area into two categories – direct extensions of our work and speculations (which are less related to it). 5.1 Direct Extensions 5.1.1 Efficiency Analysis of the Double Auctions A more comprehensive efficiency analysis of the double auction is still needed. Our treatment of the double auction was incomplete in the sense that we did not conclude with a strong efficiency result even for an unrealistic model. We only showed evidence for the mechanism’s efficiency. 5.1.2 More Realistic Models The markets should be analyzed, using models that are more realistic. This analysis may be based on competitiveness analysis, since we know that the mechanisms are not globally optimal. Alternatively, the analysis may use simulation. It is also possible to simulate an evolution of contracts (of buyers and sellers) in search of an evolutionary stable strategy [50, 51] for our buyers and sellers - a contract dies, when his owner goes broke. No matter what method we use, the following issues should be considered: Strategic buyers and sellers with inter-temporal considerations. A more realistic environment: Various machines speed, various production costs, packets of various sizes and risk averse agents. Other information structures, for example, sellers that provide more information about their machines. Buyers that extract their utilities from entities of higher level than JOPs. 5.1.3 Comparison with non Market-Oriented Mechanisms All our mechanisms were based on economic principles. However, the POPCORN system was designed in a way that enables us to replace parts of the system without the modification of other parts. It is possible to plug-in a matching mechanism that bases its operation on more conventional scheduling or load-balancing algorithms [52]. Therefore, a comparison with such mechanisms should be carried out. 5.1.4 Generalizing to Other Goods We view POPCORN as a case study for an economic-oriented computational system. It is an instance of a larger family of possible online systems. The same markets that we used in POPCORN may be used for other goods too. This, however, may require the definition of other billing schemes. Our results and analysis apply for an arbitrary market only if, 1. 2. One) The traded good can be decomposed into uniform atomic particles (e.g. JOPs, bytes) and the its ‘size’ can be measured in terms of these atomic particles. It is reasonable to make our specific assumptions about the buyers and sellers: The value attributed by the buyer to the good is linear in its size and a buyer prefers a good ‘today’ over the same good ‘tomorrow’. Two) The sellers’ costs are time-dependent. Three) Buyers and sellers know their types which are mutually independent. 37 Four) The buyers and sellers are risk neutral. Consider for example a system for trading in Internet communication bandwidth. Various agents own ‘bandwidth’ resources, some have too much of it (at least during part of the day), while others are “willing to sell their grandmothers” for a few more bytes per second. This asymmetry means that there may be a place for trade in this resource. The first thing that has to be done, when designing the new market, is to define the bandwidth commodity. Following the discussion in chapter 2, we would like the price of this commodity to be related to its cost of production on one hand and to its value for buyers on the other. One possible analog of a POPCORN computelet in this context is a URL that interests the buyer, and a possible analog to a result is the resulting document. A pricing scheme, analog to the per-JOP pricing scheme, is paying per-BYTE of the result. If we are willing to make the set of assumptions 2a – 2d, then our recommendation for the clearinghouse auction holds. 5.2 Speculations An allocation mechanism for the Internet environment should be distributed. In our simulations of the complete POPCORN system, we observed that the market is the communicational bottleneck of the system [4]. It turns out that the current architecture can only support a small number of packets per second. This problem could be diminished by various optimizations but the fundamental problem remains: our architecture is only partially distributed – the agents decisions are distributed but the trade is done at a single physical location. To remedy this problem, the various mechanisms may be distributed over several computers. Alternatively, we can construct a network of markets. It is not clear (to us) how the present POPCORN mechanisms could be distributed. Our mechanisms have something else in common – they are all auctions. Other market mechanisms should also be considered. A new market may be a variation on one of our markets (for example, a Vickrey auction in which the sellers’ turn is based on other criterion than his arrival time at the market), or a completely different mechanism. It is clear from the previous paragraph that some care must be taken when choosing a new mechanism. We feel that two properties of auctions should be present in any such mechanism: it should minimize the communication of the system, and preferably, it should be incentive compatible (at least when there are many buyers and sellers). We have ignored inter-market interaction and general equilibrium analysis. However, in POPCORN, there are many markets and each market has some influence over the rest. Assume, for example, that all the markets are stable and for some reason, there is an unexpected rise in prices at the clearinghouse market and that the change is visible to all potential buyers. Thus, it is reasonable to expect an increase in the demand at the Vickrey market in response to this event, and we know from our simulations that this results in a price increase at the Vickrey market. This rise in price at the Vickrey market may be mirrored in the original clearinghouse market, and the process may end in convergence to some new equilibrium. A major achievement of modern economic theory is the formal analysis of general market equilibrium and it is possible to use this theory in the context of computational markets [53]. The construction of markets for software agents is also an active area of research [54, 55, 56]. It would be interesting to check how suitable our mechanisms are as markets for software agents. For example, Sandholm [54] shows the limitations of a single-round Vickrey auction as a market for software agents but the effect of multiple rounds on such an analysis is not clear. Moreover, to our best knowledge, no one has considered double auction markets in this context. Another issue, which we completely ignored, is the issue of market failures. We know from both theory and practice, that free markets tend to fail occasionally and need some guidance in 38 their way back to tracks. It would be interesting to consider this issue in the context of online computational markets, since some computational systems have some special requirements that generally do not exist in other markets. For example, a real-time computational system needs to react quickly to external events, and markets may not always be suitable [57]. In our discussions, we frequently mentioned the issue of the information structure of the economy. We have seen that various assumptions about the information available to the agents have substantial effect over the market behavior. We are not clear about the “correct” information structure for the economy. One way of dealing with this problem is to let the agents decide. That is, provide the facilities for making information public, but let the agents decide for themselves what to publish. Perhaps, such policy would lead to the emergent of a market for information, driven by economic forces. 39 Appendix A – Economic-Oriented Computational Systems A.1 Introduction The idea to use economic techniques, models, and intuitions, for solving a computational problem and in particular for solving the allocation of computational resources is not new [58]. However, it is not clear weather computer science has something to gain from using economic oriented approaches, in solving computational problems. In the past decade there has been increasing interest in this question, and some work was done towards answering it. A few systems were built and analyzed – systems that used economic concepts in their design and operation. We do not refer here to the use of computers in order to solve an economic problem. We refer to the opposite situation, where computer scientists use economic theory in order to solve a computational problem. We explain the motivations for taking this path. We characterize the basic parts of such systems (the players, the goods, and the markets) and enumerate the areas to which economic oriented approaches were applied. Since the research in this area is still in its early stages, and many variants exist, it is difficult to unite the attempts into a comprehensive and consistent theory. Therefore, we focus on research that is relevant to our work, and briefly discuss other areas. A.2 Motivations What are the benefits in introducing economic principles and considerations into a computational system? Perhaps the canonical example for the use of economics in computer science has been the need to solve some resource allocation problem [53, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71]. The allocation problem in these cases is complex, and this complexity is the result of the fact that a mechanism needs to allocate resources among a set of interacting components. These components are autonomous and have contradicting interests. Moreover, the problem domain is distributed, and some degree of communication is needed in order to solve it. Formulating the problem as an economic problem, in which the various agents are competing over the available resources, makes it possible to use economic principles and mechanisms in the solution. Markets are relatively well understood mechanisms, for solving these types of problems and their allocations can be proven socially efficient subject to certain assumptions. The proposed economic based solutions are usually scalable. The economic oriented problem solver can solve the problem for a large number of participants [53, 59, 71, 72, 73]. This scalability is the result of the fact that when the economic paradigm is used, every agent tries to locally maximize his utility and the mechanism is designed in such a way that it aggregates these local operations into an efficient global outcome. A property we mentioned earlier, but did not emphasize, is the decentralized nature of the economic solution. The system can be vied as a decentralized allocation algorithm, an important property in some domains. Some system designers have chosen to use economic solutions because of this decentralized nature [61, 63, 71, 72, 73]. Like other decentralized systems, the solution is generally robust to the failure of some of the domain’s components [74]. Another property of economic based solutions is that they adapt to a changing environment. The solution changes with response to changes in a dynamic environment [59, 72, 74, 75]. In some cases, the motivation for using economic principles in the solution is that the problem domain resembles to an economy. This is the case, for example, when the ownership of resources is distributed among the agents [75, 76, 77, 78]. 40 A.3 Applications A.3.1 Resources Allocation and Sharing Computational markets have been used in the allocation of various computational resources. 1. CPU time. A popular resource, whose allocation is studied, is CPU time. The problem is in effect a scheduling problem, where tasks need to be assigned to available machines. One of the first attempts in this direction was the Contract Net. The Contract Net defines a protocol for the distribution of tasks among agents by the owner of these tasks. Briefly, the tasks owner announces the new tasks, the agents evaluate them, submit bids, winners are chosen and the tasks are executed by them. The Contract Net protocols define the negotiation that can take place and therefore provides a coordination mechanism among the agents. Enterprise [72] uses this idea for scheduling tasks to workstations on a LAN. The idea is to use the workstations’ idle time, while their “owner” is away. Like in the case of the Contract Net, Enterprise can not be called “a market for computational resources”. Instead, it uses a set of bidding and assignment protocols and a few heuristics for its scheduling decisions. Ferguson et al. [70] present an economy that uses decentralized competition and a price system to perform load balancing in a LAN of workstations. In contrast to Enterprise and Contract Net the mechanism is implementing an economy. The mechanism allows jobs to migrate to cheaper workstations and to compute there. Migrating and computing cost money, for which the jobs must pay. Chronologically, the next generation in this family is consisted of Challenger [75] and Spawn [59]. Challenger was built directly on top of Enterprise. The innovation of Challenger is that the agents now have learning capabilities. This learning capability on the agents part, makes the system more robust in face of network latencies, latencies in the agents decision, and errors in the estimation of the jobs duration. Spawn’s goal is also allocating tasks to idle workstations in a LAN. Spawn has many economic characteristics. Among them are, a currency for making deals, software components called “resource managers” that are selling their spare CPU time in markets, etc. Bogan [60] has developed an economy for the scheduling of jobs on a single CPU. 2. Network Resources A second class of computational resources that is studied, are network resources. We divide networked resources into two main categories. The first category includes resources that are needed for the functioning of the underlying network. These resources include the transmitted network packets (in packet switching networks), virtual circuits (in ATM networks), etc. The second category includes services that are reachable and accessed through a network. These resources include information sources like online libraries, broadcasting services, web sites, FTP sites, etc. For both categories of resources, various pricing and allocation schemes for network resource were proposed [61, 63, 64, 65, 66, 67, 71, 79, 80, 81, 82, 83, 84] . Most of these works rely on game theoretic and microeconomic concepts. Some of the works are applicable in LANs and some are aimed to provide solutions for the Internet environment. 3. Electronic Information The problem of allocating electronic information among users has also been the subject of some research. Examples for this direction are, database management systems [85], the University of Michigan Digital Library project (UMDL) [86], and PEAK [87]. These 41 projects handle (among other things) the special character of information as a tradable good. A.3.2 Market for Interacting Computational Agents Another area of research that attracted the use of economic considerations has been the area of software agents. The interaction among software agents is sometimes modeled as economic trade [54, 55, 72, 75, 76, 77, 88]. In other cases, researchers are seeking to support trade among software agents by creating an agent marketplace [56, 89]. A.3.3 Fault Tolerant and Adaptive Systems One property of market mechanisms that was largely ignored by the works we have mentioned, is the robustness of markets in face of local failures. By this, we mean that it takes more than a few local failures to bring the whole system down on its knees. One system that utilizes this fact is a market-based architecture for information survivability [74]. This work tries to ensure the survivability and the adaptivity of information systems, by using market mechanisms as the underlying architecture. A.4 The Underlying Economy So far, we have characterized the various computational and economic oriented works by describing the domains, to which they apply economic concepts, and by describing the motivations of the designer. However, this is only one (and perhaps the least interesting) characterization. A more meaningful one is to identify common and distinct features in the underlying economies. We are not aware of such characterization, and we believe that it highlights important aspects of the economic methodology. In many cases, the designers of a system do not explicitly state their assumptions about the nature of the underlying economy. In such cases, it is difficult to put to use economic theory and predictions. First, we consider the “purity” of the various solutions. Next, we enumerate four “dimensions” that together define the “space” of possible solutions. A.4.1 The Economy’s purity We differentiate between market-oriented and market-like systems. In a market-like system, the designer uses the metaphor of a market, however the system does not correspond to an economy. There could be many reasons for the system to be only market-like. For example, the Enterprise [72] system is only market-like because it uses a set of predefined scheduling heuristics that determine the ‘prices’ of tasks in the system. Thus, the prices are not determined by market forces, and therefore the system does not have economic characteristics. Examples for systems that correspond to ‘true’ economies are Spawn, which implemented an economy of many local markets, the various Walras based economies, which correspond to neoclassic oriented economies [60, 61, 62], and Ferguson’s economies [71]. To be called an economy, a system should be comprised of many selfish autonomous parts. It must support some interaction mechanisms, through which the agents can interact. In the usual case, the economy’s traded goods are explicitly defined. Explicit price systems are usually present, the prices are derived from demand and supply and information is transferred via these price systems. The market institutions can vary. They could be implemented as negotiations protocols, auction mechanism, etc. A.4.2 The Economy’s Agents Various systems may deal with different types of agents, who comprise the economy. The agents may be human agents, they may be software agents, or they may be software components. For example, in systems like Kasbah [56], and Challenger [75] the agents are 42 software agents. On the other hand, in systems like Spawn components, which may also be controlled by humans. [59] , the agents are software The assumptions, made by the system’s designer about the abilities of the agents, are also important. Are they assumed to behave rationally? [53] Are there any computational bounds over their rationality? Do they behave as utility maximizers? [53, 59, 71] Do they have learning capabilities? [75] Can their preferences be expressed as utility functions? Etc. Another important question is weather the players cooperate or compete. Some combination of the two is also possible. In general, we find that the systems with more pure economies are also based on competition. The market-like systems present cooperation among the agents in some of the cases. The last issue, that concerns the agents, deals with resources distribution and ownership. Many questions can be asked in this context. Who are the owners of the initial resources? How are these resources distributed? Are the resources scarce or perhaps there are enough resources for everyone? These characteristics affect the trade patterns that emerge in the system. A.4.3 The Goods The definition of the traded goods in the economy is also important [90]. Some systems do not explicitly define the goods, while other may give imprecise definitions [75], and of course some give precise and explicit definitions [53, 59, 63, 71, 83]. The good can be information good of some kind (the popular case, which interests us here) or some other good that has nothing to do with computers or information [56]. The good may be divisible or non-divisible. An example for divisible good can be found in the CPU allocation domains, where a task may sometimes be divisible. Examples for non-divisible goods are virtual circuits, and packets in the networked domains. In some cases [53], there may be more than one good in the economy. In such cases, it is reasonable to ask if there are some relations among the various goods. Two goods may be complementary or substitutes, or they may be unrelated. For example, the Walras algorithm, which is the basis for a few systems, correctly solves the economy’s equilibrium problem, only for the case in which the goods are gross substitutes [14]. In the case of multiple markets, the concept that we are usually interested in, is general equilibrium. In the case of a single market, the concepts of partial and general equilibrium coincide. A.4.4 The Information Structure An important characteristic of an economic system is its information structure [14]. One way of characterizing a system is by describing the manner, by which the information is scattered among the agents. Various questions arise. What information is made public? What information is assumed common knowledge? [25] What information is private for a given agent and how is the security of the private information guarantied. For example, Walras [53] and Enterprise [72] assume that prices are public and globally known, others assume that prices have a locality property. That is, the prices proposed by a particular agent are only known to nearby agents [59, 71] . All works, that we are aware of, assume that the “rules of the game” are common knowledge. Most works also assume that the agents posses some private information. The importance of private information in computerized market based systems is discussed in Drexler and Miller [68]. Milgrom & Webber [32, 91] discuss the importance of the privacy of information in general trade. Another issue that is related to the information structure, is the information flow patterns in the economy. In some computational economies [59, 70, 92], the agents can only communicate with “nearby” agents (the term “nearby” needs to be precisely defined in these cases). Others 43 may assume that an agent can communicate with any other agent on a broadcast basis (this is usually the case in LAN based systems). Yet, others may assume that agents can only meet and communicate in designated spots (the marketplaces), which is the case in POPCORN. A.4.5 The Market Mechanism In almost every economic oriented work in computer science that we are aware of, one identifies some sort of a market institution. The exceptions are systems, which are based on bilateral negotiation. Thus, in a system that is economic oriented, it is important to discuss the characterization of the market. Some systems use a market that simulates neo-classic tatonnement process [14] in order to solve the general equilibrium for the economy [53]. Many systems use various auction mechanisms [59, 65, 66, 67, 70, 71, 57]. Some systems use highly distributed markets, based on bilateral encounters, that are not usually treated by economic theory, but can definitely be called markets [59, 70, 71, 92] . The markets may be exchange markets (as in barter economies), or use a monetary medium to handle the trade. We have already mentioned that there may be more than one market in the economy, but the majority of the systems are concerned with single good economies. When more than one good exist in the economy, the system must deal with interaction among the various markets. This issue is rarely treated in a systematic way, and various heuristics are used instead. One important question is weather the allocation of the market can be proved efficient or close to efficient, subject to the designers assumptions. This is the case in some systems [53, 65, 66, 67, 64, 81] . In other cases [59, 69, 71, 57], the systems can only be evaluated by simulations, since the answer is beyond the scope of existing theory. In some works, the question is not considered at all [73, 75, 56]. Another issue concerns the stability of the market and the speed in which it converges to equilibrium (if one exists). Do the prices behave erratically or are they relatively stable? In general, we prefer stable markets, because the agents can base their decisions on more reliable and accessible information, and can spend fewer resources over bids preparation, etc. The speed of convergence is very important in some cases. For example, in tatonnement based mechanisms [53], no trade takes place until the equilibrium prices are calculated. Therefore, in such systems, it is highly important that convergence is fast. A related issue is the adaptivity of the market to changes. In markets that adapt to the changing environment, we would like this adaptation process to be short, because it has obvious implication over the efficiency of the mechanism. Two other interrelated issues concern the scalability and distributional character of the market. We have mentioned earlier a market mechanism [92] that is highly distributed, in the sense that every transaction is a bilateral deal among two neighbors. Such systems are highly scalable in nature, but do not fit to some environments. Other market implementations are centralized and can be easily scaled in the number of goods, but because of their centrality, may not scale in the number of agents [53]. An important factor that has influence over these issues, is the market’s communication intensity. Systems that base their operations on broadcasts [72, 75] do not scale. Another issue is the market robustness to errors and failures. All of the existing systems assume that the agents attribute some value for a given good. In many situations, it is the case that the agent can only estimate this valuation. It is therefore reasonable to ask if the market mechanism can efficiently allocate the resource in cases where these estimates are error prone. 44 Many researchers ignore this point. An interesting exceptions is Challenger [75], where agents are learning from their environment, and are able to use this information in future transactions. In comparison to Enterprise [72], which is an ancestor of Challenger, the new learning capabilities lead to improved performance of the system. Other failure forms are also possible. For example, network latencies may lead to degradation in the allocation’s efficiency. The last issue, which is also ignored in most cases, is the issue of the allocations’ fairness. An allocation of resources may be efficient, and ‘unfair’ at the same time. The distribution of wealth in the economy is usually not considered. The issue of fairness is quite elaborated in welfare economics, and this theory may be used to evaluate the suggested solutions. Lazar and Semret [64] prove that their network resources allocation mechanism is fair (“envy free”). A.5 Analytical Modeling Vs. Simulations Almost all of the existing works in this area use simulations, somewhere along the way of evaluating their solutions. The obvious advantage of simulations is that they allow the designer test his system in realistic situations. However, some works have also modeled their economy. Some mechanisms were proven efficient under a set of assumptions [53, 65, 66, 67, 64, 81]. It is possible in these cases, to check the plausibility of the precise assumptions, and get a “first order approximation” for the quality of their solution. A.6 Software Engineering Aspects of Market Oriented Systems The various existing works can also be categorized and evaluated by using more traditional computer science criterions. However, most of these works do not describe their architecture in depth. Therefore, we will limit this section to description of the various computational issues in computational markets. The first issue is the issue of encapsulation, which is extremely important for market oriented systems. Encapsulation and data abstraction is generally considered important by software engineers, and its importance is emphasized in our domain. Drexler and Miller [68] explain the importance of encapsulation in the context of computational markets. They refer to “encapsulation and communication of information, access and resources among objects”. They explain the expected problems of systems that fail to provide for these foundations, and why they cannot be called open market based systems. They show the parallels between these concepts and the concept of ownership and property rights in real world economies, without which the market economies can hardly function. Encapsulation, both in computer systems and in economies, also serves as a mean of reducing complexity. In general, most of the marketbased systems that we mentioned have the notion of encapsulation deeply rooted in their architectures. The second issue is the communication and algorithmic complexity of a given system. Some systems [53, 75] require a substantial amount of communication to function. In other, auction-based systems [59, 57], submission of sealed bids is sufficient. Such mechanisms are not communication-intensive. The algorithmic complexity of the mechanism also varies from one market to another. Sealed bid auctions are usually very simple, and could sum up to sorting the submitted bids and choosing a winner. This is not the case for tatonnement-based systems. The third issue is the modularity of a given market-based system. We feel that the modularity of a market-based system is also important. First, this area of research is still young, and no superior solution is yet known. Therefore, it is important that one can easily replace parts of the system. For example, it might turn out that a specific mechanism is improper because the assumptions about the agents behavior were wrong, and a new mechanism should be introduced. Second, market oriented systems are usually intended to be “open” systems, in 45 the sense that they can be extended by people, who are not the original designers. For example, markets, which are intended for software agents [56], should be accessible to agents, which were designed by people, who did not participate in the original design phase. The last computational issue we consider is security. In order to provide encapsulation and ownership of resources, security means should be provided. Most of the works, mentioned earlier, ignore this issue. Some of the previous works mention the issue, but no solutions are presented [59, 68, 73]. However, in most case, enhancing the system to include security support, seems to be a straightforward matter. A.7 Conclusion We have surveyed the related works that use economic oriented solutions in solving computational problems. We tried to sort the issues into general categories, which we believe may be a starting point for a mapping of the area. However, this is only our point of view on the subject and not the necessarily the point of view of the authors of the surveyed works. Many important questions remain open and seem far from being fully answered. 46 Appendix B – Proof of Lemma 1 Lemma 1: Denote by x the allocation chosen by the Vickrey mechanism throughout its rounds, over the input stream of orders. Subject to the assumptions of section 2.1, there exists no other legal allocation x x for the given input that is potentially Pareto preferred to x. Proof of lemma 1: Let x ( x1 , , x q ) be a legal allocation of the seller’s machines to buyers, as chosen by some other unknown mechanism. We consider the mechanisms after they have halted, i.e. both of the mechanisms find no more possible matches, given the input stream. The Vickrey mechanism termination could mean that all of the sellers have disconnected, or that all of the buyers’ orders have been fulfilled. We can’t make such a statement about the other mechanism, since we don’t have enough information about it. If q r then we add padding zeros to the shorter vector, so that their lengths become equal. The following algorithm transforms x into x. Procedure Transform( x , x ) { While ( x x ) { // transforms x into x Let y ( y1 y j ) be the common prefix of x and x If ( y x ) then return If ( y null ) then let j0 // Note: it must be the case that x j 1 0 - otherwise x j 1 would // also be zero Let t x j 1 // save old buyer value to use later Let x j 1 x j 1 // store new buyer value into x Let S {s | s j , x s x j 1 } // later matchings of buyer x j 1 under // If ( S ) then { Let l min( S ) xl t x // if buyer x j 1 is later matched // under x // find the next such matching // match old buyer later at that // point } // Note: if x j 1 is never matched later, then x j 1 is simply // discarded. } } 47 Let x h be the resulting vector after h iteration of the algorithm. Let W x h denote the social welfare resulting from the allocation represented by x h . Let x j h denote the j -th coordinate of x h . Claim 1: After the algorithm terminates, x is transformed into x . Proof: After the padding, the input vectors are of equal lengths. If the vectors are identical, then the algorithm terminates. Let j 1 be the index of the first coordinate on which x and x h disagree. During this iteration, the j 1 -th coordinate of x h is changed to equal the j 1 -th coordinate of x , the length of x h does not change, and the coordinates 1,2, j of x h do not change. Thus, the length of the common prefix of x h1 is at least j 1 . The length of the vectors is final, so the algorithm must terminate □ Claim 2: If x h is legal then, 1. x h1 is legal. 2. W x h W x h 1 . Proof: 1. x h1 is legal: The algorithm may change x h in two possible ways: a swap operation (when S ), and a replace operation (when S ). Consider first the case S then the algorithm swaps the l -th coordinate and the j 1 th coordinate of x h . Note that l j 1 . Since all of the packets are of equal length, the execution of the new j 1 -th buyer’s packet will terminate at exactly the same time as the old j 1 -th buyer’s packet. The same is true for both the new and old packets at the point represented by the l -th coordinate. Hence, the rest of the allocation is not affected by the swap, and the scheduling at both of these points is legal, since the original scheduling at these points was legal. Now, if S , the j 1 -th buyer’s packet is discarded and another packet is scheduled instead at that point in time. Again, the rest of the allocation is not affected and the allocation at point j 1 must be legal because x is legal. It follows then that x h 1 is a legal allocation. 2. W x h W x h 1 : We show that in any of the two possible operations that turn x h into x h 1 the social welfare can only increase. The Swap Operation: Consider first the case where S : 48 The social gain from the deal represented by x j1 h is, ( j 1) d L(V x j 1 h e z ) L( ( j 1) d V x 0 j 1 h e z) Similarly, the social gains from the deals represented by xj1 h1 , xlh , xlh 1 are, ( j 1) d L(V x e z ) L( ( j 1) d V x 0 j 1 h 1 j 1 h 1 e z) , L(V x e z ) L( ld V x e z ) , l h l h ld 0 and L(V x e z ) L( ld V x e z ) ld 0 l h 1 l h 1 respectively. The following three relations also hold: l j 1, x j 1 h 1 x j 1 xlh , xlh1 xj1 h . And since the Vickrey mechanism always chooses the buyer with the highest valuation (“highest” type, where the type is determined at time 0) we also have: V xj1 h1 V x j1 V x j1 h . 0 0 0 When swapping the coordinates as stated by the algorithm, we gain ( j 1) d (V x V x 2 e ) * L , z l h 1 ld j 1 h 1 and loose ( j 1) d (V x j 1 h V x 2 e ) * L . z l h ld Thus, the total added gain from the swap operation equals, ( j 1) d ( j 1) d (V x V x V x V x ) * L j 1 h 1 l h l h 1 j 1 h ( ( j 1) d V x 0 ld ld ld V x ld V x ( j 1) d V x ) * L 0 j 1 h 1 0 ( ( j 1) d V x ld V x ld V x 0 j 1 0 j 1 0 ( j 1) d V x ) * L j 1 h [V x ( ( j 1) d ld ) V x 0 j 1 h l h 1 l h 0 0 0 j 1 ( j 1 h j 1 h ( j 1) d ld )] * L (V x V x ) * ( ( j 1) d ld ) * L 0 0 0 j 1 j 1 h 49 The last inequality is true because all of its multiplicands are positive: L 0 . We have already explained why the first multiplicand is greater than zero, and for the middle one, we know that l j 1 , d 0 , and 0 1 , hence it is positive too. The Replace Operation Consider next the case where S : In this case, Like was the case for the swap operation, the social gain from the deal represented by x is, j 1 h ( j 1) d L(V x j 1 h e z ) L( ( j 1) d V x 0 j 1 h e z) Similarly, the social gain from the deal represented by x j 1 h 1 is, ( j 1) d L(V x e z ) L( ( j 1) d V x 0 j 1 h 1 j 1 h 1 e z) Again, we have: V x V x . x j1 h 1 j 1 j 1 h 0 V 0 0 It follows immediately that the operation of replacing x j1 h with xj1 h1 increases the social welfare □ From the previous claims it follows that when the algorithm terminates after H iterations, we end up with x . Thus, we have a series x x 0 , x 1 , , xH x , for which W x h W x h 1 for each h {0,1, H } and hence x is not potentially Pareto preferred to x . This completes the proof of lemma 1 □ 50 References [1] T. E. Anderson, D. E. Culler and D. A. Patterson, “A Case for Networks of Workstations: NOW”, IEEE Micro, Feb 1995, http://now.cs.berkeley.edu. [2] JavaSoft homepage, http://www.javasoft.com/index.html [3] The Popcorn Market homepage, http://www.cs.huji.ac.il/~popcorn/use.html. [4] N. Nisan, S. London, O. Regev, N. Camiel “Globally Distributed Computation over the Internet – The POPCORN Project”, proceedings for the 18th International Conference on Distributed Computing Systems (ICDCS'98), Amsterdam, The Netherlands, 1998, to appear. [5] The POPCORN homepage, http://www.cs.huji.ac.il/~popcorn. [6] N. Camiel, S. London, N. Nisan and O. Regev, “The POPCORN Project -- An Interim Report, Distributed Computation over the Internet in Java”, Proceedings of the sixth international World Wide Web conference (CD version), 1997, http://www.cs.huji.ac.il/~popcorn/documentation/www6/poster.html. [7] S. London, The Popcorn Tutorial, http://www.cs.huji.ac.il/~popcorn/developer/tutorial/index.html. [8] D. E. Spray. “The Principle Stock Exchanges of the World: Their Operation, Structure, and Development”, International Economic Publishers Inc., Washington D.C., 1964. [9] W.J. Eitman, and S.C. Eitman. “Nine Leading Stock Exchanges”, Ann Arbor, Michigan International Business Studies, The University of Michigan, 1968. [10] D. K. Whitcomb. “An international Comparison of Stock Exchange Trading Structures”. In Market Making and the Changing Structure of Securities Industry, Y. Amihud, T. S. Y. Ho and R. A. Schwartz (ed.) 237-255. Lexington Books, 1985. [11] I. Domowitz. “Automating the Continuous Double Auction in Practice: Automated Trade Execution Systems in Financial Markets”. The Double Auction Market Institutions, Theories, and Evidence, Eds. D. Friedman and J. Rust, Proceeding of The Workshop On Double Auction Markets, Santa Fe, New Mexico, June 1991. [12] K. Arrow, and F. Hahn. “General Competitive Analysis”, North Holland Publishing Co., Amsterdam, 1978. 51 [13] G. Debreu. “Theory of Value”, John Wiley Sons, New York, 1959. [14] H. R. Varian. “Microeconomic Analysis”. W. W. Norton & Company, Inc. Third Edition, 1992. [15] K. J. Arrow. “The Potentials and Limits of the Market in Resource Allocation”. Issues in Contemporary Microeconomics and Welfare, ed. by G. Feiwel. London. The Macmillan Press Ltd., Ch. 2, pp. 107-123, 1985. [16] S. London. Master’s thesis, in preparation. [17] P. M. Hallam-Baker. “Electronic Payment Schemes”. World Wide Web Consortium, http://www.w3.org/ECommerce/roadmap.html. [18] The Popcorn Gallery, http://www.cs.huji.ac.il/~popcorn/gallery/index.html [19] The Popcorn publisher homepage, http://www.cs.huji.ac.il/~popcorn/publisher/index.html [20] R. Engelbrecht-Wiggans. “Auctions and Bidding Models: A Survey”. Management Science, 26, pp. 119-142, 1980. [21] P. R. Milgrom. “Auction Theory”. In T. Bewley ed., Advances in Economic theory: Fifth World Congress. Cambridge: Cambridge University Press. [22] P. R. Milgrom. “Auctions and Bidding: A Primer”. Journal of Economic Perspectives, Vol. 3 (3), pp. 3-22, Summer 1989. [23] W. Vickrey. “Counterspeculation, Auctions, and Competitive Sealed Tenders”. Journal of Finance, 16, pp. 8-37, March 1961. [24] D. Friedman. “The Double Auction Market Institution: A Survey”. The Double Auction Market Institutions, Theories, and Evidence, Eds. D. Friedman and J. Rust, Proceeding of The Workshop On Double Auction Markets, Santa Fe, New Mexico, June 1991. [25] D. Fudenberg, and J. Tirole. “Game Theory”. Forth Edition, MIT Press 1995. [26] J. Harasanyi. “Games with incomplete information played by Bayesian players”. Management Science 14 pp. 159-182, pp. 320-334, pp. 486-502, 1967-68. [27] P. R. McAfee, and J. McMillan. “Auctions and Bidding”. Journal of Economic Literature, 25, pp. 699-738, June 1987. [28] O. Ashenfelter. “How auctions work for wine and art”. Journal of Economic Perspective 3, pp. 23-36, 1989. [29] P. R. McAfee, and D. Vincent. “The Declining Price Anomaly”. Journal of Economic Theory 60, pp. 191-212, 1993. [30] R. Weber. “Multi Object Auctions”. Auctions Bidding and Contracting: Uses and Theory, eds. R. Engelbrecht-Wiggans, M. Shubik and R. M. Stark, New York University Press, pp.165-194, 1983. [31] D. Sleator, and R. Tarjan. “Amortized Efficiency of List Update and Paging Rules”. Communications of the ACM, 28(2), pp. 202-208, 1985. [32] P. Milgrom, and R. Weber. “A Theory of Auctions and Competitive Bidding”. Econometrica 50, 1089-1122, November 1982. 52 [33] E. Maskin, and J. Riley. “Existence and Uniqueness of Equilibrium in Sealed High Bid Auctions”. Mimeo, UCLA, March 1986. [34] P. Milgrom, and R. Weber. “Distributional Strategies for Games with Incomplete Information”. Math Operations Research, 10, pp. 619-632, November 1985. [35] F. Menezes, and P. Monteiro. “Sequential Asymmetric Auctions With Endogenous Participation”. Economics Working Paper Archive, http://econwpa.wustl.edu/wpawelcome.html, ewp-mic/9402001, 1994. [36] S. P. Doron. “The Tel Aviv Stock Exchange – its history and development”, The Tel Aviv Stock Exchange, Tel Aviv, Israel, 1960. [37] P. R. McAfee. “A Dominant Strategy Double Auction”. Journal of Economic Theory 56, pp. 434-450, 1992. [38] A. Rustichini, and M. Satterthwaite, and S. Williams. “Convergence to Price-Taking Behaviour in a Simple Market”. D.P. 914, Center for Mathematical Studies in Economics and Management Science, December 1990. [39] H. Mendelson. “Market Behavior in a Clearing House”. Econometrica 47, pp. 61-74, 1982. [40] J. Gosling, B. Joy, and G. Steele. “The Java Language Specification”. §21.7, pp. 643, Addison-Wesley, 1996. [41] R. Wilson. “Efficient Trading”. Issues in Contemporary Microeconomics and Welfare, ed. by G. Feiwel. London. The Macmillan Press Ltd., Ch. 4, pp. 169-208, 1985. [42] The CORBA/IIOP Homepage, http://www.omg.org/corba/corbiiop.htm. [43] B. Strousrup. “The C++ Programming Language”. Addison-Wesley Publishing Company, Second Edition, 1995. [44] N. Camiel. Master’s Thesis, in preparation. [45] P. Agarwal, and M. Sharir. “Davenport-Schinzel sequences and their geometric applications”, Chapter in Handbook of Computational Geometry, J.R. Sack (Ed.), North-Holland, submitted for publication. [46] G. Hardin. “The Tragedy of the Commons”. Science, 162 pp. 1243-1248, 1968. [47] T. Lindholm, and F. Yellin. “The Java Virtual Machine Specification”, Addison-Wesley, 1997. [48] J. Gosling, B. Joy, and G. Steele. “The Java Language Specification”. §20.20, pp. 587, Addison-Wesley, 1996. [49] J. Gosling, B. Joy, and G. Steele. “The Java Language Specification”. §17, pp. 399-418, Addison-Wesley, 1996. [50] J. Maynard Smith. “Evolution and The Theory of Games”. Cambridge University Press, Cambridge, 1982. [51] J. W. Weibull. “Evolutionary Game Theory”. The MIT Press, Cambridge, Massachusetts, 1995. [52] J. Sgall. “On-Line Scheduling – A Survey”. To appear in the proceedings of the Dagstuhl workshop on On-Line Algorithms, eds. A. Fiat and G. Woeginger, Lecture Notes in Computer Science, Springer-Verlag. 53 [53] J. Q. Cheng, and M. P. Wellman. “The WALRAS algorithm: A convergent distributed implementation of general equilibrium outcomes”. Computational Economics, to appear. [54] T. Sandholm. “Limitations of the Vickrey Auction in Computational Multiagent Systems”. Second International Conference on Multiagent Systems (ICMAS-96), Keihanna Plaza, Kyoto, Japan, December, pp. 299-306, 1996. [55] T. Sandholm, and V. Lesser. “Equilibrium Analysis of the Possibilities of Unenforced Exchange in Multiagent Systems”. 14th International Joint Conference on Artificial Intelligence (IJCAI-95), Montreal, Canada, pp. 694-701, 1995. [56] A. Chavez, and P. Maes. “Kasbah: An Agent Marketplace for Buying and Selling goods”. Proceedings of the First International Conference on the Practical Application of Intelligent Agents and Multi-Agent Technology, pp. 75-90, London, UK, April 1996. [57] F. Ygge, and H. Akkermans. “Power load management as a computational market”. Second International Conference on Multiagent Systems, Kyoto, Japan, AAAI Press, 1996. [58] I. E. Sutherland. “A futures market in computer time”. Communications of the ACM 11:449451, 1968. [59] C. A. Waldspurger, et al. "Spawn: A Distributed Computational Economy". IEEE Trans. on Software Engineering, Vol. 18, No. 2, Feb 1992. [60] N. R. Bogan. “Economic allocation of computation time with computation markets”. Master’s thesis, Massachusetts Institute of Technology, Department of Electrical Engineering and Computer Science, May 1994. [61] T. Mullen, and M. P. Wellman. “A simple computational market for network information services”. First International Conference on Multiagent Systems, San Francisco, CA, MIT Press 1995. [62] M. P. Wellman. “A market-oriented programming environment and its application to distributed multicommodity flow problems”. Journal of Artificial Intelligence Research, 1:1-23, 1993. [63] R. Cocchi, D. Estrin, S. Shenker, et al. “Pricing in computer networks: Motivation, formulation, and example”. IEEE Transactions on Networking 1(6): 614-627, 1993. [64] A. Lazar, and N. Semret. “Auction for Network Resource Sharing”. CTR Technical Report: CU/CTR/TR 468-97-02, Center for Telecommunications Research, Columbia University, February 1997. [65] J. K. MacKie-Mason, and H. R. Varian. “Pricing congestible resources”. IEEE Journal on Selected Areas in Communications 13(7): 1141-1149, 1995. [66] J. K. MacKie-Mason, and H. R. Varian. “Pricing the Internet”. Public Access to the Internet Ed. B. Kahin, and J. Keller. MIT Press. 269-314, 1995. [67] J. K. MacKie-Mason, and H. R. Varian. “Some economics of the Internet”. Networks, Infrastructure, and the New Task for Regulation Ed. W. Sichel. University of Michigan Press, 1996. [68] M. S. Miller, and K. E. Drexler. “Markets and Computation: Agoric Open Systems”. The Ecology of Computation Ed. B. A. Huberman. North-Holland. 133-176, 1988. 54 [69] B. Huberman. “Computation as Economics”. Second International Conference in Economics and Finance, 1996. [70] D. Ferguson, Y. Yemini, and C. Nikolaou. “Microeconomic algorithms for load balancing in distributed computer systems”. Eighth International Conference on Distributed Computing Systems, 1988. [71] D. Ferguson. “The Application of Microeconomics to the Design of Resource Allocation and Control Mechanisms”. Ph.D. thesis, Columbia University, 1989. [72] T. W. Malone, et al. “Enterprise: A Market-like Task Scheduler for Distributed Computing Environments”. The Ecology of Computation Ed. B. A. Huberman. North-Holland. 177-205, 1988. [73] A. D. Alexandrov, M. Ibel, K. E. Schauser and C. J. Scheiman. “SuperWeb: Towards a Global Web-Based Parallel Computing Infrastructure”, 11th International Parallel Processing Symposium (IPPS'97), Geneva, April 1997. [74] M. P. Wellman, J. K. MacKie-Mason, and S. Jamin. “Market-Based Adaptive Architectures for Information Survivability”. http://ai.eecs.umich.edu/people/wellman/MARX/ [75] A. Chavez, A. Moukas, and P. Maes. “Challenger: A Multi Agent System for Distributed Resource Allocation”. Proceedings of the First International Conference on Autonomous Agents. Marina del Ray, California, February 1997. [76] J. S. Rosenschein, and G. Zlotkin. “Rules of Encounter: Designing Conventions for Automated Negotiation among Computers”. MIT Press, 1994. [77] C. Boutilier, Y. Shoham, and M. P. Wellman. “Editorial: Economic Principles of Multi-Agent Systems”. Artificial Intelligence Journal, Special Issue on Economic Principles of Multi-Agent Systems, 1997. [78] H. R. Varian. “Economic Mechanism Design for Computerized Agents”. USENIX Workshop on Electronic Commerce, July 11-12, 1995, New York, NY. ftp://alfred.sims.berkeley.edu/pub/Papers/mechanism-design.pdf [79] J. K. MacKie-Mason, S. Shenker, and H. R. Varian. “Network architecture and content provision: An economic analysis”. The Internet and Telecommunications Policy Ed. G. Brock, and G. Rosston. Lawrence Erlbaum, 1996. [80] T. Mullen, and M. P. Wellman. “Market-based negotiation for digital library services”. Second USENIX Workshop on Electronic Commerce, Oakland, CA, USENIX Association, 1996. [81] A. Gupta, D. O. Stahl, A. B. Whinston. “Managing The Internet as an Economic System”. University of Texas at Austin, Research Papers, 1994. [82] J. K. MacKie-Mason, J. Murphy, and L. Murphy. “Feedback and efficiency in ATM networks”. International Conference on Communications, IEEE 1996. [83] Y. A. Korilis, A. Lazar, and A. Orda. “Architecting Noncooperative Networks”. Journal on Selected Areas in Communications 13(7): 1241-1251, 1995. [84] B. Awerbuch, Y. Azar, and S. Plotkin. “Throughput-competitive on-line routing”. 34th IEEE Symposium on Foundations of Computer Science, Palo Alto, CA, 1993. 55 [85] M. Stonebraker, R. Devine, M. Kornacker, et al. “An economic paradigm for query processing and data migration in Mariposa”. Third International Conference on Parallel and Distributed Information Systems, Las Vegas, NV, 1994. [86] The University of Michigan Digital Library Project, http://www.si.umich.edu/UMDL/. [87] J. K. MacKie-Mason, and A. L. Jankovich. “PEAK: Pricing Electronic Access to Knowledge”. http://www-personal.umich.edu/~jmm/papers/PEAK/. [88] R. Davis, and R. G. Smith. “Negotiation as a Metaphor for Distributed Problem Solving”. Artificial Intelligence 20: 63-109, 1983. [89] A. Chavez, D. Dreilinger, R. Guttman, et. al. “A Real-Life Experiment in Creating an Agent Marketplace”. Proceedings of the Second International Conference on the Practical Application of Intelligent Agents and Multi-Agent Technology (PAAM'97). London, UK, April 1997. [90] M. P. Wellman. “Market-oriented programming: Some early lessons”. Market-Based Control: A Paradigm for Distributed Resource Allocation Ed. S. Clearwater. World Scientific, 1996. [91] P. Milgrom, and R. Weber. “The Value of Information in a Sealed-Bid Auction”. Journal of Mathematical Economics, 10, pp. 105-114, 1982. [92] R. Axtell, and J. M. Epstein. “Growing Artificial Societies: Social Science from the Bottom Up”. MIT Press, 1997. 56