edu.usc.bg.workloads
Class CoreWorkload

java.lang.Object
  extended by edu.usc.bg.base.Workload
      extended by edu.usc.bg.workloads.CoreWorkload

public class CoreWorkload
extends Workload

responsible for creating the benchmarking workload for issuing the queries based on the workload file specified

Author:
barahman

Field Summary
static java.lang.String ACCEPTFRIENDSACTION_PROPORTION_PROPERTY
          Percentage users that do the acceptfriends action
static java.lang.String ACCEPTFRIENDSACTION_PROPORTION_PROPERTY_DEFAULT
          The default proportion of acceptfriends action
static java.lang.String ACCEPTFRIENDSHIP_PROPORTION_PROPERTY
          Percentage users that do the accept friendship sequence
static java.lang.String ACCEPTFRIENDSHIP_PROPORTION_PROPERTY_DEFAULT
          The default proportion of functionalities that are acceptFriendship
static java.lang.String DELCOMMENTONRESOURCE_PROPORTION_PROPERTY
          Percentage users that delete comment on their own resource
static java.lang.String DELCOMMENTONRESOURCE_PROPORTION_PROPERTY_DEFAULT
          The default proportion of functionalities that are delCommentOnResource
static java.lang.String DELCOMMENTONRESOURCEACTION_PROPORTION_PROPERTY
          Percentage users that do the delcommentonresources action
static java.lang.String DELCOMMENTONRESOURCEACTION_PROPORTION_PROPERTY_DEFAULT
          The default proportion of delcommentonresources action
static java.lang.String ENABLE_LOGGING_PROPERTY
           
static boolean enableLogging
          Once set to true, BG generates log files for the actions issued
static boolean enforceFriendship
           
static java.lang.String GENERATEFRIENDSHIP_PROPORTION_PROPERTY
          Percentage users that do the generate friendship requests in their sessions
static java.lang.String GENERATEFRIENDSHIP_PROPORTION_PROPERTY_DEFAULT
          The default proportion of functionalities that are generateFriendRequest
static java.lang.String GETCOMMENTSONRESOURCEACTION_PROPORTION_PROPERTY
          Percentage users that do the getcommentsonresources action
static java.lang.String GETCOMMENTSONRESOURCEACTION_PROPORTION_PROPERTY_DEFAULT
          The default proportion of getcommentsonresources action
static java.lang.String GETFRIENDPROFILE_PROPORTION_PROPERTY
          Percentage users that access their friend profile property name
static java.lang.String GETFRIENDPROFILE_PROPORTION_PROPERTY_DEFAULT
          The default proportion of functionalities that are ViewFrdProfile
static java.lang.String GETOWNPROFILE_PROPORTION_PROPERTY
          Percentage users that only access their own profile property name
static java.lang.String GETOWNPROFILE_PROPORTION_PROPERTY_DEFAULT
          The default proportion of functionalities that are ViewSelfProfile
static java.lang.String GETRANDOMLISTOFFRIENDSACTION_PROPORTION_PROPERTY
          Percentage users that do the listFriends action
static java.lang.String GETRANDOMLISTOFFRIENDSACTION_PROPORTION_PROPERTY_DEFAULT
          The default proportion of listFriends action
static java.lang.String GETRANDOMLISTOFPENDINGREQUESTSACTION_PROPORTION_PROPERTY
          Percentage users that do the getlistofpendingrequests action
static java.lang.String GETRANDOMLISTOFPENDINGREQUESTSACTION_PROPORTION_PROPERTY_DEFAULT
          The default proportion of getlistofpendingrequests action
static java.lang.String GETRANDOMPROFILEACTION_PROPORTION_PROPERTY
          Percentage users that do the getProfile action
static java.lang.String GETRANDOMPROFILEACTION_PROPORTION_PROPERTY_DEFAULT
          The default proportion of getprofile action
static java.lang.String GETTOPRESOURCEACTION_PROPORTION_PROPERTY
          Percentage users that do the gettopresources action
static java.lang.String GETTOPRESOURCEACTION_PROPORTION_PROPERTY_DEFAULT
          The default proportion of gettopresources action
static java.util.HashMap<java.lang.String,java.lang.Integer> initStats
           
static java.lang.String INVITEFRIENDSACTION_PROPORTION_PROPERTY
          Percentage users that do the inviteFriend action
static java.lang.String INVITEFRIENDSACTION_PROPORTION_PROPERTY_DEFAULT
          The default proportion of inviteFriend action
static java.lang.String POSTCOMMENTONRESOURCE_PROPORTION_PROPERTY
          Percentage users that post comment on their own resource
static java.lang.String POSTCOMMENTONRESOURCE_PROPORTION_PROPERTY_DEFAULT
          The default proportion of functionalities that are postCommentOnResource
static java.lang.String POSTCOMMENTONRESOURCEACTION_PROPORTION_PROPERTY
          Percentage users that do the postcommentonresources action
static java.lang.String POSTCOMMENTONRESOURCEACTION_PROPORTION_PROPERTY_DEFAULT
          The default proportion of postcommentonresources action
static boolean readsExist
          keeps a track of the existence of reads in the workload if no reads have occurred or no read log files created the validation check need not happen-shared for all threads
static java.lang.String REJECTFRIENDSACTION_PROPORTION_PROPERTY
          Percentage users that do the rejectfriends action
static java.lang.String REJECTFRIENDSACTION_PROPORTION_PROPERTY_DEFAULT
          The default proportion of rejectfriends action
static java.lang.String REJECTFRIENDSHIP_PROPORTION_PROPERTY
          Percentage users that do the reject friendship sequence
static java.lang.String REJECTFRIENDSHIP_PROPORTION_PROPERTY_DEFAULT
          The default proportion of functionalities that are rejectFriendship
static java.lang.String REQUEST_DISTRIBUTION_PROPERTY
          The name of the property for the the distribution of requests across the keyspace.
static java.lang.String REQUEST_DISTRIBUTION_PROPERTY_DEFAULT
          The default distribution of requests across the keyspace
static java.lang.String UNFRIEND_PROPORTION_PROPERTY
          Percentage users that do the unfriend friendship user session
static java.lang.String UNFRIEND_PROPORTION_PROPERTY_DEFAULT
          The default proportion of functionalities that are unFriendFriend
static java.lang.String UNFRIENDACCEPTFRIENDSHIP_PROPORTION_PROPERTY
          Percentage users that do the unfriend/accept friendship sequence
static java.lang.String UNFRIENDACCEPTFRIENDSHIP_PROPORTION_PROPERTY_DEFAULT
          The default proportion of functionalities that are unfriend/accept
static java.lang.String UNFRIENDFRIENDSACTION_PROPORTION_PROPERTY
          Percentage users that do the unfriendfriends action
static java.lang.String UNFRIENDFRIENDSACTION_PROPORTION_PROPERTY_DEFAULT
          The default proportion of unfriendfriends action
static java.lang.String UNFRIENDREJECTFRIENDSHIP_PROPORTION_PROPERTY
          Percentage users that do the unfriend/reject friendship sequence
static java.lang.String UNFRIENDREJECTFRIENDSHIP_PROPORTION_PROPERTY_DEFAULT
          The default proportion of functionalities that are unfriend/reject
static boolean updatesExist
          Keeps a track of existence of updates in the workload if no updates have occurred or no update log files have been created the validation check need not happen-shared for all threads
static java.lang.String VIEWNEWSFEEDACTION_PROPORTION_PROPERTY
          Percentage users that do the viewNewsFeed action
static java.lang.String VIEWNEWSFEEDACTION_PROPORTION_PROPERTY_DEFAULT
          The default proportion of viewNewsFeed action
static java.lang.String ZIPF_MEAN_PROPERTY
          needed for zipfian distributions
static java.lang.String ZIPF_MEAN_PROPERTY_DEFAULT
           
 
Constructor Summary
CoreWorkload()
           
 
Method Summary
 int activateUser(int uid)
           
 int buildKeyName(int keynum)
           
 void createCommentAttrs(java.util.HashMap<java.lang.String,ByteIterator> commentValues)
           
 void deactivateUser(int uid)
           
 void deRelateUsers(int uid1, int uid2)
           
 int doActionAcceptFriends(DB db, int threadid, java.lang.StringBuilder updateLog, java.lang.StringBuilder readLog, int seqID, java.util.HashMap<java.lang.String,java.lang.Integer> friendshipInfo, java.util.HashMap<java.lang.String,java.lang.Integer> pendingInfo, int thinkTime, boolean insertImage, boolean warmup)
           
 int doActionDelComments(DB db, int threadid, java.lang.StringBuilder updateLog, java.lang.StringBuilder readLog, int seqID, java.util.HashMap<java.lang.String,java.lang.Integer> resUpdateOperations, int thinkTime, boolean insertImage, boolean warmup)
           
 int doActionGetFriends(DB db, int threadid, java.lang.StringBuilder updateLog, java.lang.StringBuilder readLog, int seqID, boolean insertImage, boolean warmup)
           
 int doActionGetPendings(DB db, int threadid, java.lang.StringBuilder updateLog, java.lang.StringBuilder readLog, int seqID, boolean insertImage, boolean warmup)
           
 int doActionGetProfile(DB db, int threadid, java.lang.StringBuilder updateLog, java.lang.StringBuilder readLog, int seqID, boolean insertImage, boolean warmup)
           
 int doActionGetTopResources(DB db, int threadid, java.lang.StringBuilder updateLog, java.lang.StringBuilder readLog, int seqID, boolean insertImage, boolean warmup)
           
 int doActioninviteFriend(DB db, int threadid, java.lang.StringBuilder updateLog, java.lang.StringBuilder readLog, int seqID, java.util.HashMap<java.lang.String,java.lang.Integer> friendshipInfo, java.util.HashMap<java.lang.String,java.lang.Integer> pendingInfo, boolean insertImage, boolean warmup)
           
 int doActionPostComments(DB db, int threadid, java.lang.StringBuilder updateLog, java.lang.StringBuilder readLog, int seqID, java.util.HashMap<java.lang.String,java.lang.Integer> resUpdateOperations, int thinkTime, boolean insertImage, boolean warmup)
           
 int doActionRejectFriends(DB db, int threadid, java.lang.StringBuilder updateLog, java.lang.StringBuilder readLog, int seqID, java.util.HashMap<java.lang.String,java.lang.Integer> friendshipInfo, java.util.HashMap<java.lang.String,java.lang.Integer> pendingInfo, int thinkTime, boolean insertImage, boolean warmup)
           
 int doActionUnFriendFriends(DB db, int threadid, java.lang.StringBuilder updateLog, java.lang.StringBuilder readLog, int seqID, java.util.HashMap<java.lang.String,java.lang.Integer> friendshipInfo, java.util.HashMap<java.lang.String,java.lang.Integer> pendingInfo, int thinkTime, boolean insertImage, boolean warmup)
           
 int doActionviewCommentOnResource(DB db, int threadid, java.lang.StringBuilder updateLog, java.lang.StringBuilder readLog, int seqID, int thinkTime, boolean insertImage, boolean warmup)
           
 boolean doInsert(DB db, java.lang.Object threadstate)
          Do one insert operation.
 int doTransaction(DB db, java.lang.Object threadstate, int threadid, java.lang.StringBuilder updateLog, java.lang.StringBuilder readLog, int seqID, java.util.HashMap<java.lang.String,java.lang.Integer> resUpdateOperations, java.util.HashMap<java.lang.String,java.lang.Integer> friendshipInfo, java.util.HashMap<java.lang.String,java.lang.Integer> pendingInfo, int thinkTime, boolean insertImage, boolean warmup)
          Do one transaction operation.
 int doTransactionAcceptFriendship(DB db, int threadid, java.lang.StringBuilder updateLog, java.lang.StringBuilder readLog, int seqID, java.util.HashMap<java.lang.String,java.lang.Integer> friendshipInfo, java.util.HashMap<java.lang.String,java.lang.Integer> pendingInfo, int thinkTime, boolean insertImage, boolean warmup)
           
 int doTransactionDeleteCommentOnResource(DB db, int threadid, java.lang.StringBuilder updateLog, java.lang.StringBuilder readLog, int seqID, java.util.HashMap<java.lang.String,java.lang.Integer> resUpdateOperations, int thinkTime, boolean insertImage, boolean warmup)
           
 int doTransactionFriendProfile(DB db, int threadid, java.lang.StringBuilder updateLog, java.lang.StringBuilder readLog, int seqID, int thinkTime, boolean insertImage, boolean warmup)
           
 int doTransactionGenerateFriendship(DB db, int threadid, java.lang.StringBuilder updateLog, java.lang.StringBuilder readLog, int seqID, java.util.HashMap<java.lang.String,java.lang.Integer> friendshipInfo, java.util.HashMap<java.lang.String,java.lang.Integer> pendingInfo, int thinkTime, boolean insertImage, boolean warmup)
           
 int doTransactionOwnProfile(DB db, int threadid, java.lang.StringBuilder updateLog, java.lang.StringBuilder readLog, int seqID, int thinkTime, boolean insertImage, boolean warmup)
           
 int doTransactionPostCommentOnResource(DB db, int threadid, java.lang.StringBuilder updateLog, java.lang.StringBuilder readLog, int seqID, java.util.HashMap<java.lang.String,java.lang.Integer> resUpdateOperations, int thinkTime, boolean insertImage, boolean warmup)
           
 int doTransactionRejectFriendship(DB db, int threadid, java.lang.StringBuilder updateLog, java.lang.StringBuilder readLog, int seqID, java.util.HashMap<java.lang.String,java.lang.Integer> friendshipInfo, java.util.HashMap<java.lang.String,java.lang.Integer> pendingInfo, int thinkTime, boolean insertImage, boolean warmup)
           
 int doTransactionUnfriendFriendship(DB db, int threadid, java.lang.StringBuilder updateLog, java.lang.StringBuilder readLog, int seqID, java.util.HashMap<java.lang.String,java.lang.Integer> friendshipInfo, java.util.HashMap<java.lang.String,java.lang.Integer> pendingInfo, int thinkTime, boolean insertImage, boolean warmup)
           
 int doTransactionUnfriendPendingFriendship(DB db, int threadid, java.lang.StringBuilder updateLog, java.lang.StringBuilder readLog, int seqID, java.util.HashMap<java.lang.String,java.lang.Integer> friendshipInfo, java.util.HashMap<java.lang.String,java.lang.Integer> pendingInfo, int thinkTime, java.lang.String nextOp, boolean insertImage, boolean warmup)
           
 java.util.HashMap<java.lang.String,java.lang.String> getDBInitialStats(DB db)
          Gets the initial statistics from the data stores: member count, friend count per user, pending friend count per user and the resource count per user assuming all users initially have the same number of confirmed and pending friendships.
static java.lang.String getFrequecyStats()
           
 void incrUserRef(int uid)
           
 void init(java.util.Properties p, java.util.Vector<java.lang.Integer> members)
          Initialize the scenario.
 int isActive(int uid)
           
 boolean isRelated(int uid1, int uid2)
           
 void relateUsers(int uid1, int uid2)
           
 boolean resetDBInternalStructures(java.util.Properties p, int executionMode)
          Initialize the internal data structures keeping a track of databases state.
 int viewNotRelatedUsers(int uid)
           
 
Methods inherited from class edu.usc.bg.base.Workload
cleanup, initThread, isStopRequested, requestStop, setStopRequested
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

enableLogging

public static boolean enableLogging
Once set to true, BG generates log files for the actions issued


ENABLE_LOGGING_PROPERTY

public static final java.lang.String ENABLE_LOGGING_PROPERTY
See Also:
Constant Field Values

ZIPF_MEAN_PROPERTY

public static final java.lang.String ZIPF_MEAN_PROPERTY
needed for zipfian distributions

See Also:
Constant Field Values

ZIPF_MEAN_PROPERTY_DEFAULT

public static final java.lang.String ZIPF_MEAN_PROPERTY_DEFAULT
See Also:
Constant Field Values

REQUEST_DISTRIBUTION_PROPERTY

public static final java.lang.String REQUEST_DISTRIBUTION_PROPERTY
The name of the property for the the distribution of requests across the keyspace. Options are "uniform", "zipfian" and "latest"

See Also:
Constant Field Values

REQUEST_DISTRIBUTION_PROPERTY_DEFAULT

public static final java.lang.String REQUEST_DISTRIBUTION_PROPERTY_DEFAULT
The default distribution of requests across the keyspace

See Also:
Constant Field Values

GETOWNPROFILE_PROPORTION_PROPERTY

public static final java.lang.String GETOWNPROFILE_PROPORTION_PROPERTY
Percentage users that only access their own profile property name

See Also:
Constant Field Values

GETOWNPROFILE_PROPORTION_PROPERTY_DEFAULT

public static final java.lang.String GETOWNPROFILE_PROPORTION_PROPERTY_DEFAULT
The default proportion of functionalities that are ViewSelfProfile

See Also:
Constant Field Values

GETFRIENDPROFILE_PROPORTION_PROPERTY

public static final java.lang.String GETFRIENDPROFILE_PROPORTION_PROPERTY
Percentage users that access their friend profile property name

See Also:
Constant Field Values

GETFRIENDPROFILE_PROPORTION_PROPERTY_DEFAULT

public static final java.lang.String GETFRIENDPROFILE_PROPORTION_PROPERTY_DEFAULT
The default proportion of functionalities that are ViewFrdProfile

See Also:
Constant Field Values

POSTCOMMENTONRESOURCE_PROPORTION_PROPERTY

public static final java.lang.String POSTCOMMENTONRESOURCE_PROPORTION_PROPERTY
Percentage users that post comment on their own resource

See Also:
Constant Field Values

POSTCOMMENTONRESOURCE_PROPORTION_PROPERTY_DEFAULT

public static final java.lang.String POSTCOMMENTONRESOURCE_PROPORTION_PROPERTY_DEFAULT
The default proportion of functionalities that are postCommentOnResource

See Also:
Constant Field Values

DELCOMMENTONRESOURCE_PROPORTION_PROPERTY

public static final java.lang.String DELCOMMENTONRESOURCE_PROPORTION_PROPERTY
Percentage users that delete comment on their own resource

See Also:
Constant Field Values

DELCOMMENTONRESOURCE_PROPORTION_PROPERTY_DEFAULT

public static final java.lang.String DELCOMMENTONRESOURCE_PROPORTION_PROPERTY_DEFAULT
The default proportion of functionalities that are delCommentOnResource

See Also:
Constant Field Values

GENERATEFRIENDSHIP_PROPORTION_PROPERTY

public static final java.lang.String GENERATEFRIENDSHIP_PROPORTION_PROPERTY
Percentage users that do the generate friendship requests in their sessions

See Also:
Constant Field Values

GENERATEFRIENDSHIP_PROPORTION_PROPERTY_DEFAULT

public static final java.lang.String GENERATEFRIENDSHIP_PROPORTION_PROPERTY_DEFAULT
The default proportion of functionalities that are generateFriendRequest

See Also:
Constant Field Values

ACCEPTFRIENDSHIP_PROPORTION_PROPERTY

public static final java.lang.String ACCEPTFRIENDSHIP_PROPORTION_PROPERTY
Percentage users that do the accept friendship sequence

See Also:
Constant Field Values

ACCEPTFRIENDSHIP_PROPORTION_PROPERTY_DEFAULT

public static final java.lang.String ACCEPTFRIENDSHIP_PROPORTION_PROPERTY_DEFAULT
The default proportion of functionalities that are acceptFriendship

See Also:
Constant Field Values

REJECTFRIENDSHIP_PROPORTION_PROPERTY

public static final java.lang.String REJECTFRIENDSHIP_PROPORTION_PROPERTY
Percentage users that do the reject friendship sequence

See Also:
Constant Field Values

REJECTFRIENDSHIP_PROPORTION_PROPERTY_DEFAULT

public static final java.lang.String REJECTFRIENDSHIP_PROPORTION_PROPERTY_DEFAULT
The default proportion of functionalities that are rejectFriendship

See Also:
Constant Field Values

UNFRIEND_PROPORTION_PROPERTY

public static final java.lang.String UNFRIEND_PROPORTION_PROPERTY
Percentage users that do the unfriend friendship user session

See Also:
Constant Field Values

UNFRIEND_PROPORTION_PROPERTY_DEFAULT

public static final java.lang.String UNFRIEND_PROPORTION_PROPERTY_DEFAULT
The default proportion of functionalities that are unFriendFriend

See Also:
Constant Field Values

UNFRIENDACCEPTFRIENDSHIP_PROPORTION_PROPERTY

public static final java.lang.String UNFRIENDACCEPTFRIENDSHIP_PROPORTION_PROPERTY
Percentage users that do the unfriend/accept friendship sequence

See Also:
Constant Field Values

UNFRIENDACCEPTFRIENDSHIP_PROPORTION_PROPERTY_DEFAULT

public static final java.lang.String UNFRIENDACCEPTFRIENDSHIP_PROPORTION_PROPERTY_DEFAULT
The default proportion of functionalities that are unfriend/accept

See Also:
Constant Field Values

UNFRIENDREJECTFRIENDSHIP_PROPORTION_PROPERTY

public static final java.lang.String UNFRIENDREJECTFRIENDSHIP_PROPORTION_PROPERTY
Percentage users that do the unfriend/reject friendship sequence

See Also:
Constant Field Values

UNFRIENDREJECTFRIENDSHIP_PROPORTION_PROPERTY_DEFAULT

public static final java.lang.String UNFRIENDREJECTFRIENDSHIP_PROPORTION_PROPERTY_DEFAULT
The default proportion of functionalities that are unfriend/reject

See Also:
Constant Field Values

GETRANDOMPROFILEACTION_PROPORTION_PROPERTY

public static final java.lang.String GETRANDOMPROFILEACTION_PROPORTION_PROPERTY
Percentage users that do the getProfile action

See Also:
Constant Field Values

GETRANDOMPROFILEACTION_PROPORTION_PROPERTY_DEFAULT

public static final java.lang.String GETRANDOMPROFILEACTION_PROPORTION_PROPERTY_DEFAULT
The default proportion of getprofile action

See Also:
Constant Field Values

GETRANDOMLISTOFFRIENDSACTION_PROPORTION_PROPERTY

public static final java.lang.String GETRANDOMLISTOFFRIENDSACTION_PROPORTION_PROPERTY
Percentage users that do the listFriends action

See Also:
Constant Field Values

GETRANDOMLISTOFFRIENDSACTION_PROPORTION_PROPERTY_DEFAULT

public static final java.lang.String GETRANDOMLISTOFFRIENDSACTION_PROPORTION_PROPERTY_DEFAULT
The default proportion of listFriends action

See Also:
Constant Field Values

GETRANDOMLISTOFPENDINGREQUESTSACTION_PROPORTION_PROPERTY

public static final java.lang.String GETRANDOMLISTOFPENDINGREQUESTSACTION_PROPORTION_PROPERTY
Percentage users that do the getlistofpendingrequests action

See Also:
Constant Field Values

GETRANDOMLISTOFPENDINGREQUESTSACTION_PROPORTION_PROPERTY_DEFAULT

public static final java.lang.String GETRANDOMLISTOFPENDINGREQUESTSACTION_PROPORTION_PROPERTY_DEFAULT
The default proportion of getlistofpendingrequests action

See Also:
Constant Field Values

INVITEFRIENDSACTION_PROPORTION_PROPERTY

public static final java.lang.String INVITEFRIENDSACTION_PROPORTION_PROPERTY
Percentage users that do the inviteFriend action

See Also:
Constant Field Values

INVITEFRIENDSACTION_PROPORTION_PROPERTY_DEFAULT

public static final java.lang.String INVITEFRIENDSACTION_PROPORTION_PROPERTY_DEFAULT
The default proportion of inviteFriend action

See Also:
Constant Field Values

ACCEPTFRIENDSACTION_PROPORTION_PROPERTY

public static final java.lang.String ACCEPTFRIENDSACTION_PROPORTION_PROPERTY
Percentage users that do the acceptfriends action

See Also:
Constant Field Values

ACCEPTFRIENDSACTION_PROPORTION_PROPERTY_DEFAULT

public static final java.lang.String ACCEPTFRIENDSACTION_PROPORTION_PROPERTY_DEFAULT
The default proportion of acceptfriends action

See Also:
Constant Field Values

REJECTFRIENDSACTION_PROPORTION_PROPERTY

public static final java.lang.String REJECTFRIENDSACTION_PROPORTION_PROPERTY
Percentage users that do the rejectfriends action

See Also:
Constant Field Values

REJECTFRIENDSACTION_PROPORTION_PROPERTY_DEFAULT

public static final java.lang.String REJECTFRIENDSACTION_PROPORTION_PROPERTY_DEFAULT
The default proportion of rejectfriends action

See Also:
Constant Field Values

UNFRIENDFRIENDSACTION_PROPORTION_PROPERTY

public static final java.lang.String UNFRIENDFRIENDSACTION_PROPORTION_PROPERTY
Percentage users that do the unfriendfriends action

See Also:
Constant Field Values

UNFRIENDFRIENDSACTION_PROPORTION_PROPERTY_DEFAULT

public static final java.lang.String UNFRIENDFRIENDSACTION_PROPORTION_PROPERTY_DEFAULT
The default proportion of unfriendfriends action

See Also:
Constant Field Values

GETTOPRESOURCEACTION_PROPORTION_PROPERTY

public static final java.lang.String GETTOPRESOURCEACTION_PROPORTION_PROPERTY
Percentage users that do the gettopresources action

See Also:
Constant Field Values

GETTOPRESOURCEACTION_PROPORTION_PROPERTY_DEFAULT

public static final java.lang.String GETTOPRESOURCEACTION_PROPORTION_PROPERTY_DEFAULT
The default proportion of gettopresources action

See Also:
Constant Field Values

GETCOMMENTSONRESOURCEACTION_PROPORTION_PROPERTY

public static final java.lang.String GETCOMMENTSONRESOURCEACTION_PROPORTION_PROPERTY
Percentage users that do the getcommentsonresources action

See Also:
Constant Field Values

GETCOMMENTSONRESOURCEACTION_PROPORTION_PROPERTY_DEFAULT

public static final java.lang.String GETCOMMENTSONRESOURCEACTION_PROPORTION_PROPERTY_DEFAULT
The default proportion of getcommentsonresources action

See Also:
Constant Field Values

POSTCOMMENTONRESOURCEACTION_PROPORTION_PROPERTY

public static final java.lang.String POSTCOMMENTONRESOURCEACTION_PROPORTION_PROPERTY
Percentage users that do the postcommentonresources action

See Also:
Constant Field Values

POSTCOMMENTONRESOURCEACTION_PROPORTION_PROPERTY_DEFAULT

public static final java.lang.String POSTCOMMENTONRESOURCEACTION_PROPORTION_PROPERTY_DEFAULT
The default proportion of postcommentonresources action

See Also:
Constant Field Values

DELCOMMENTONRESOURCEACTION_PROPORTION_PROPERTY

public static final java.lang.String DELCOMMENTONRESOURCEACTION_PROPORTION_PROPERTY
Percentage users that do the delcommentonresources action

See Also:
Constant Field Values

DELCOMMENTONRESOURCEACTION_PROPORTION_PROPERTY_DEFAULT

public static final java.lang.String DELCOMMENTONRESOURCEACTION_PROPORTION_PROPERTY_DEFAULT
The default proportion of delcommentonresources action

See Also:
Constant Field Values

VIEWNEWSFEEDACTION_PROPORTION_PROPERTY

public static final java.lang.String VIEWNEWSFEEDACTION_PROPORTION_PROPERTY
Percentage users that do the viewNewsFeed action

See Also:
Constant Field Values

VIEWNEWSFEEDACTION_PROPORTION_PROPERTY_DEFAULT

public static final java.lang.String VIEWNEWSFEEDACTION_PROPORTION_PROPERTY_DEFAULT
The default proportion of viewNewsFeed action

See Also:
Constant Field Values

readsExist

public static boolean readsExist
keeps a track of the existence of reads in the workload if no reads have occurred or no read log files created the validation check need not happen-shared for all threads


enforceFriendship

public static boolean enforceFriendship

updatesExist

public static boolean updatesExist
Keeps a track of existence of updates in the workload if no updates have occurred or no update log files have been created the validation check need not happen-shared for all threads


initStats

public static java.util.HashMap<java.lang.String,java.lang.Integer> initStats
Constructor Detail

CoreWorkload

public CoreWorkload()
Method Detail

init

public void init(java.util.Properties p,
                 java.util.Vector<java.lang.Integer> members)
          throws WorkloadException
Initialize the scenario. Called once, in the main client thread, before any operations are started.

Overrides:
init in class Workload
Parameters:
p - The properties.
members - Needed for the load phase, keeps a track of the set of memberids that the BG client is responsible for.
Throws:
WorkloadException

resetDBInternalStructures

public boolean resetDBInternalStructures(java.util.Properties p,
                                         int executionMode)
Description copied from class: Workload
Initialize the internal data structures keeping a track of databases state. Create any generators and other shared objects here. Called with the continual mode of executing BG.

Overrides:
resetDBInternalStructures in class Workload
Parameters:
p - The properties.
executionMode - (0 stands for single and 1 stands for continual mode of operation)
Returns:
true if everything with settinguo the structures is fine or if the structures are already available

doTransaction

public int doTransaction(DB db,
                         java.lang.Object threadstate,
                         int threadid,
                         java.lang.StringBuilder updateLog,
                         java.lang.StringBuilder readLog,
                         int seqID,
                         java.util.HashMap<java.lang.String,java.lang.Integer> resUpdateOperations,
                         java.util.HashMap<java.lang.String,java.lang.Integer> friendshipInfo,
                         java.util.HashMap<java.lang.String,java.lang.Integer> pendingInfo,
                         int thinkTime,
                         boolean insertImage,
                         boolean warmup)
Do one transaction operation. Because it will be called concurrently from multiple client threads, this function must be thread safe. returns the number of actions done

Specified by:
doTransaction in class Workload
updateLog - The update log record created by that transaction which needs to be written to the update file.
readLog - The read log record created by that transaction which needs to be written to the update file.
seqID - For workloads issuing sessions keeps a track of the current sessionid.
resUpdateOperations - Keeps a track of all the postcomment updates issued - needed for validation based on exact values.
friendshipInfo - Keeps a track of all the confirmed friendships created throughout the benchmark execution - needed for validation based on exact values.
pendingInfo - Keeps a track of all the pending invites created during the benchmark execution - needed for validation based on exact values.
thinkTime - Think time between the actions in a session.
insertImage - If set to true means images will be retrieved for relevant actions i.e. getUserProfile.
warmup - If set to true the workload would not issue any update actions.
Returns:
greater than 0 if everything is fine.

buildKeyName

public int buildKeyName(int keynum)

doTransactionOwnProfile

public int doTransactionOwnProfile(DB db,
                                   int threadid,
                                   java.lang.StringBuilder updateLog,
                                   java.lang.StringBuilder readLog,
                                   int seqID,
                                   int thinkTime,
                                   boolean insertImage,
                                   boolean warmup)

doTransactionFriendProfile

public int doTransactionFriendProfile(DB db,
                                      int threadid,
                                      java.lang.StringBuilder updateLog,
                                      java.lang.StringBuilder readLog,
                                      int seqID,
                                      int thinkTime,
                                      boolean insertImage,
                                      boolean warmup)

doTransactionPostCommentOnResource

public int doTransactionPostCommentOnResource(DB db,
                                              int threadid,
                                              java.lang.StringBuilder updateLog,
                                              java.lang.StringBuilder readLog,
                                              int seqID,
                                              java.util.HashMap<java.lang.String,java.lang.Integer> resUpdateOperations,
                                              int thinkTime,
                                              boolean insertImage,
                                              boolean warmup)

doTransactionDeleteCommentOnResource

public int doTransactionDeleteCommentOnResource(DB db,
                                                int threadid,
                                                java.lang.StringBuilder updateLog,
                                                java.lang.StringBuilder readLog,
                                                int seqID,
                                                java.util.HashMap<java.lang.String,java.lang.Integer> resUpdateOperations,
                                                int thinkTime,
                                                boolean insertImage,
                                                boolean warmup)

doTransactionGenerateFriendship

public int doTransactionGenerateFriendship(DB db,
                                           int threadid,
                                           java.lang.StringBuilder updateLog,
                                           java.lang.StringBuilder readLog,
                                           int seqID,
                                           java.util.HashMap<java.lang.String,java.lang.Integer> friendshipInfo,
                                           java.util.HashMap<java.lang.String,java.lang.Integer> pendingInfo,
                                           int thinkTime,
                                           boolean insertImage,
                                           boolean warmup)

doTransactionAcceptFriendship

public int doTransactionAcceptFriendship(DB db,
                                         int threadid,
                                         java.lang.StringBuilder updateLog,
                                         java.lang.StringBuilder readLog,
                                         int seqID,
                                         java.util.HashMap<java.lang.String,java.lang.Integer> friendshipInfo,
                                         java.util.HashMap<java.lang.String,java.lang.Integer> pendingInfo,
                                         int thinkTime,
                                         boolean insertImage,
                                         boolean warmup)

doTransactionRejectFriendship

public int doTransactionRejectFriendship(DB db,
                                         int threadid,
                                         java.lang.StringBuilder updateLog,
                                         java.lang.StringBuilder readLog,
                                         int seqID,
                                         java.util.HashMap<java.lang.String,java.lang.Integer> friendshipInfo,
                                         java.util.HashMap<java.lang.String,java.lang.Integer> pendingInfo,
                                         int thinkTime,
                                         boolean insertImage,
                                         boolean warmup)

doTransactionUnfriendFriendship

public int doTransactionUnfriendFriendship(DB db,
                                           int threadid,
                                           java.lang.StringBuilder updateLog,
                                           java.lang.StringBuilder readLog,
                                           int seqID,
                                           java.util.HashMap<java.lang.String,java.lang.Integer> friendshipInfo,
                                           java.util.HashMap<java.lang.String,java.lang.Integer> pendingInfo,
                                           int thinkTime,
                                           boolean insertImage,
                                           boolean warmup)

doTransactionUnfriendPendingFriendship

public int doTransactionUnfriendPendingFriendship(DB db,
                                                  int threadid,
                                                  java.lang.StringBuilder updateLog,
                                                  java.lang.StringBuilder readLog,
                                                  int seqID,
                                                  java.util.HashMap<java.lang.String,java.lang.Integer> friendshipInfo,
                                                  java.util.HashMap<java.lang.String,java.lang.Integer> pendingInfo,
                                                  int thinkTime,
                                                  java.lang.String nextOp,
                                                  boolean insertImage,
                                                  boolean warmup)

doActionGetProfile

public int doActionGetProfile(DB db,
                              int threadid,
                              java.lang.StringBuilder updateLog,
                              java.lang.StringBuilder readLog,
                              int seqID,
                              boolean insertImage,
                              boolean warmup)

doActionGetFriends

public int doActionGetFriends(DB db,
                              int threadid,
                              java.lang.StringBuilder updateLog,
                              java.lang.StringBuilder readLog,
                              int seqID,
                              boolean insertImage,
                              boolean warmup)

doActionGetPendings

public int doActionGetPendings(DB db,
                               int threadid,
                               java.lang.StringBuilder updateLog,
                               java.lang.StringBuilder readLog,
                               int seqID,
                               boolean insertImage,
                               boolean warmup)

doActioninviteFriend

public int doActioninviteFriend(DB db,
                                int threadid,
                                java.lang.StringBuilder updateLog,
                                java.lang.StringBuilder readLog,
                                int seqID,
                                java.util.HashMap<java.lang.String,java.lang.Integer> friendshipInfo,
                                java.util.HashMap<java.lang.String,java.lang.Integer> pendingInfo,
                                boolean insertImage,
                                boolean warmup)

doActionAcceptFriends

public int doActionAcceptFriends(DB db,
                                 int threadid,
                                 java.lang.StringBuilder updateLog,
                                 java.lang.StringBuilder readLog,
                                 int seqID,
                                 java.util.HashMap<java.lang.String,java.lang.Integer> friendshipInfo,
                                 java.util.HashMap<java.lang.String,java.lang.Integer> pendingInfo,
                                 int thinkTime,
                                 boolean insertImage,
                                 boolean warmup)

doActionRejectFriends

public int doActionRejectFriends(DB db,
                                 int threadid,
                                 java.lang.StringBuilder updateLog,
                                 java.lang.StringBuilder readLog,
                                 int seqID,
                                 java.util.HashMap<java.lang.String,java.lang.Integer> friendshipInfo,
                                 java.util.HashMap<java.lang.String,java.lang.Integer> pendingInfo,
                                 int thinkTime,
                                 boolean insertImage,
                                 boolean warmup)

doActionUnFriendFriends

public int doActionUnFriendFriends(DB db,
                                   int threadid,
                                   java.lang.StringBuilder updateLog,
                                   java.lang.StringBuilder readLog,
                                   int seqID,
                                   java.util.HashMap<java.lang.String,java.lang.Integer> friendshipInfo,
                                   java.util.HashMap<java.lang.String,java.lang.Integer> pendingInfo,
                                   int thinkTime,
                                   boolean insertImage,
                                   boolean warmup)

doActionGetTopResources

public int doActionGetTopResources(DB db,
                                   int threadid,
                                   java.lang.StringBuilder updateLog,
                                   java.lang.StringBuilder readLog,
                                   int seqID,
                                   boolean insertImage,
                                   boolean warmup)

doActionPostComments

public int doActionPostComments(DB db,
                                int threadid,
                                java.lang.StringBuilder updateLog,
                                java.lang.StringBuilder readLog,
                                int seqID,
                                java.util.HashMap<java.lang.String,java.lang.Integer> resUpdateOperations,
                                int thinkTime,
                                boolean insertImage,
                                boolean warmup)

doActionDelComments

public int doActionDelComments(DB db,
                               int threadid,
                               java.lang.StringBuilder updateLog,
                               java.lang.StringBuilder readLog,
                               int seqID,
                               java.util.HashMap<java.lang.String,java.lang.Integer> resUpdateOperations,
                               int thinkTime,
                               boolean insertImage,
                               boolean warmup)

doActionviewCommentOnResource

public int doActionviewCommentOnResource(DB db,
                                         int threadid,
                                         java.lang.StringBuilder updateLog,
                                         java.lang.StringBuilder readLog,
                                         int seqID,
                                         int thinkTime,
                                         boolean insertImage,
                                         boolean warmup)

doInsert

public boolean doInsert(DB db,
                        java.lang.Object threadstate)
Description copied from class: Workload
Do one insert operation. Because it will be called concurrently from multiple client threads, this function must be thread safe. However, avoid synchronized, or the threads will block waiting for each other, and it will be difficult to reach the target throughput. Ideally, this function would have no side effects other than DB operations and mutations on threadstate. Mutations to threadstate do not need to be synchronized, since each thread has its own threadstate instance.

Specified by:
doInsert in class Workload

isRelated

public boolean isRelated(int uid1,
                         int uid2)

relateUsers

public void relateUsers(int uid1,
                        int uid2)

deRelateUsers

public void deRelateUsers(int uid1,
                          int uid2)

viewNotRelatedUsers

public int viewNotRelatedUsers(int uid)

isActive

public int isActive(int uid)

activateUser

public int activateUser(int uid)

deactivateUser

public void deactivateUser(int uid)

incrUserRef

public void incrUserRef(int uid)

createCommentAttrs

public void createCommentAttrs(java.util.HashMap<java.lang.String,ByteIterator> commentValues)

getDBInitialStats

public java.util.HashMap<java.lang.String,java.lang.String> getDBInitialStats(DB db)
Description copied from class: Workload
Gets the initial statistics from the data stores: member count, friend count per user, pending friend count per user and the resource count per user assuming all users initially have the same number of confirmed and pending friendships.

Specified by:
getDBInitialStats in class Workload

getFrequecyStats

public static java.lang.String getFrequecyStats()