]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
*** empty log message ***
authorsage <sage@29311d96-e01e-0410-9327-a35deaab8ce9>
Tue, 5 Jul 2005 16:14:09 +0000 (16:14 +0000)
committersage <sage@29311d96-e01e-0410-9327-a35deaab8ce9>
Tue, 5 Jul 2005 16:14:09 +0000 (16:14 +0000)
git-svn-id: https://ceph.svn.sf.net/svnroot/ceph@394 29311d96-e01e-0410-9327-a35deaab8ce9

ceph/client/Client.cc
ceph/client/SyntheticClient.cc
ceph/client/SyntheticClient.h
ceph/config.cc
ceph/tcpsyn.cc

index 911646bc92027909db5f7391b07b3e5c7aac92c5..58eaf6cc6bb12c412917a4a9481a032956f7a015 100644 (file)
@@ -390,7 +390,7 @@ int Client::flush_inode_buffers(Inode *in)
  */
 int Client::release_inode_buffers(Inode *in)
 {
-  dout(1) << "release_inode_buffers IMPLEMENT ME" << endl;
+  dout(2) << "release_inode_buffers IMPLEMENT ME" << endl;
 }
 
 
index d39510b446d925c92c9aa4201a0802d840fa8cb7..855a11d48f0ceca5f9f544893749b419fa9f2f2e 100644 (file)
@@ -24,10 +24,25 @@ void *synthetic_client_thread_entry(void *ptr)
   return (void*)r;
 }
 
+string SyntheticClient::get_sarg() 
+{
+  string a;
+  if (!sargs.empty()) {
+       a = sargs.front(); 
+       sargs.pop_front();
+  }
+  if (a.length() == 0 || a == "~") {
+       char s[20];
+       sprintf(s,"syn.%d", client->whoami);
+       a = s;
+  } 
+  //cout << "a is " << a << endl;
+  return a;
+}
 
 int SyntheticClient::run()
 { 
-  if (modes.empty()) modes.push_back(mode);
+  run_start = g_clock.gettimepair();
 
   for (list<int>::iterator it = modes.begin();
           it != modes.end();
@@ -35,21 +50,55 @@ int SyntheticClient::run()
        int mode = *it;
                 
        switch (mode) {
+       case SYNCLIENT_MODE_UNTIL:
+         {
+               int iarg1 = iargs.front();
+               iargs.pop_front();
+               dout(2) << "until " << iarg1 << endl;
+               timepair_t dur(iarg1,0);
+               run_until = run_start + dur;
+         }
+         break;
        case SYNCLIENT_MODE_RANDOMWALK:
-         random_walk(iarg1);
+         {
+               int iarg1 = iargs.front();
+               iargs.pop_front();
+               dout(2) << "randomwalk " << iarg1 << endl;
+               random_walk(iarg1);
+         }
          break;
        case SYNCLIENT_MODE_MAKEDIRS:
-         make_dirs(sarg1.c_str(), iarg1, iarg2, iarg3);
+         {
+               string sarg1 = get_sarg();
+               int iarg1 = iargs.front();  iargs.pop_front();
+               int iarg2 = iargs.front();  iargs.pop_front();
+               int iarg3 = iargs.front();  iargs.pop_front();
+               dout(2) << "makedirs " << sarg1 << " " << iarg1 << " " << iarg2 << " " << iarg3 << endl;
+               make_dirs(sarg1.c_str(), iarg1, iarg2, iarg3);
+         }
          break;
        case SYNCLIENT_MODE_FULLWALK:
-         full_walk(sarg1);
+         {
+               string sarg1 = sargs.front(); sargs.pop_front();
+               dout(2) << "fullwalk" << sarg1 << endl;
+               full_walk(sarg1);
+         }
          break;
        case SYNCLIENT_MODE_WRITEFILE:
-         write_file(sarg1, iarg1, iarg2);
+         {
+               string sarg1 = sargs.front(); sargs.pop_front();
+               int iarg1 = iargs.front();  iargs.pop_front();
+               int iarg2 = iargs.front();  iargs.pop_front();
+               write_file(sarg1, iarg1, iarg2);
+         }
          break;
        case SYNCLIENT_MODE_READFILE:
-         dout(2) << "readfile" << endl;
-         read_file(sarg1, iarg1, iarg2);
+         {
+               string sarg1 = sargs.front(); sargs.pop_front();
+               int iarg1 = iargs.front();  iargs.pop_front();
+               int iarg2 = iargs.front();  iargs.pop_front();
+               read_file(sarg1, iarg1, iarg2);
+         }
          break;
        default:
          assert(0);
@@ -122,6 +171,8 @@ void SyntheticClient::up()
 
 int SyntheticClient::full_walk(string& basedir) 
 {
+  if (g_clock.gettimepair() > run_until) return 0;
+
   // read dir
   map<string, inode_t*> contents;
   int r = client->getdir(basedir.c_str(), contents);
@@ -150,6 +201,8 @@ int SyntheticClient::full_walk(string& basedir)
 
 int SyntheticClient::make_dirs(const char *basedir, int dirs, int files, int depth)
 {
+  if (g_clock.gettimepair() > run_until) return 0;
+
   // make sure base dir exists
   int r = client->mkdir(basedir, 0755);
   if (r != 0) {
@@ -189,6 +242,7 @@ int SyntheticClient::write_file(string& fn, int size, int wrsize)   // size is i
   if (fd < 0) return fd;
 
   for (int i=0; i<chunks; i++) {
+       if (g_clock.gettimepair() > run_until) return 0;
        dout(2) << "writing block " << i << "/" << chunks << endl;
        client->write(fd, buf, wrsize, i*wrsize);
   }
@@ -208,6 +262,7 @@ int SyntheticClient::read_file(string& fn, int size, int rdsize)   // size is in
   if (fd < 0) return fd;
 
   for (int i=0; i<chunks; i++) {
+       if (g_clock.gettimepair() > run_until) return 0;
        dout(2) << "reading block " << i << "/" << chunks << endl;
        client->read(fd, buf, rdsize, i*rdsize);
   }
@@ -222,13 +277,15 @@ int SyntheticClient::random_walk(int num_req)
 {
   int left = num_req;
 
-  dout(1) << "random_walk() will do " << left << " ops" << endl;
+  //dout(1) << "random_walk() will do " << left << " ops" << endl;
 
   init_op_dist();  // set up metadata op distribution
  
   while (left > 0) {
        left--;
 
+       if (g_clock.gettimepair() > run_until) return 0;
+
        // ascend?
        if (cwd.depth() && roll_die(.05)) {
          up();
index 1f281dbfcecc2db813f0b9073c46f9b8711d187d..74df64fd5b33b0a9bac2fcfbfc1d64cb71f9f41d 100644 (file)
@@ -11,6 +11,7 @@
 #define SYNCLIENT_MODE_MAKEDIRS    3
 #define SYNCLIENT_MODE_WRITEFILE   4
 #define SYNCLIENT_MODE_READFILE    5
+#define SYNCLIENT_MODE_UNTIL       6
 
 class SyntheticClient {
   Client *client;
@@ -84,10 +85,13 @@ class SyntheticClient {
   int run();
 
   // run() will do one of these things:
-  int mode;
   list<int> modes;
-  string sarg1;
-  int iarg1, iarg2, iarg3;
+  list<string> sargs;
+  list<int> iargs;
+  timepair_t run_start;
+  timepair_t run_until;
+
+  string get_sarg();
   
   int full_walk(string& fromdir);
   int random_walk(int n);
@@ -95,6 +99,7 @@ class SyntheticClient {
   int write_file(string& fn, int mb, int chunk);
   int read_file(string& fn, int mb, int chunk);
 
+
 };
 
 #endif
index a98509ddaea7aa382f892d5b188272f3ff8d2d07..7eaa28beb91d3711db3d1b3fc178c496212fdd6c 100644 (file)
@@ -9,8 +9,8 @@
 #define AVG_PER_INODE_SIZE    450
 #define MDS_CACHE_MB_TO_INODES(x) ((x)*1000000/AVG_PER_INODE_SIZE)
 
-#define MDS_CACHE_SIZE       MDS_CACHE_MB_TO_INODES( 50 )
-//#define MDS_CACHE_SIZE 25000  // 
+//#define MDS_CACHE_SIZE       MDS_CACHE_MB_TO_INODES( 50 )
+#define MDS_CACHE_SIZE 1500000
 
 
 // hack hack hack ugly FIXME
@@ -95,30 +95,31 @@ md_config_t g_conf = {
 
   fakeclient_op_statfs:     false,
 
-  fakeclient_op_stat:     10,
+  // loosely based on Roselli workload paper numbers
+  fakeclient_op_stat:     610,
   fakeclient_op_lstat:      false,
-  fakeclient_op_utime:    10,   // untested
-  fakeclient_op_chmod:    10,
-  fakeclient_op_chown:    10,   // untested
+  fakeclient_op_utime:    0,
+  fakeclient_op_chmod:    1,
+  fakeclient_op_chown:    1,
 
-  fakeclient_op_readdir:  10,
+  fakeclient_op_readdir:  20,
   fakeclient_op_mknod:    10,
   fakeclient_op_link:     false,
-  fakeclient_op_unlink:   10,
+  fakeclient_op_unlink:   5,
   fakeclient_op_rename:   100,
 
   fakeclient_op_mkdir:    50,
   fakeclient_op_rmdir:    0,  // there's a bug...10,
   fakeclient_op_symlink:  10,
 
-  fakeclient_op_openrd:   100,
-  fakeclient_op_openwr:   100,
-  fakeclient_op_openwrc:  100,
+  fakeclient_op_openrd:   200,
+  fakeclient_op_openwr:   0,
+  fakeclient_op_openwrc:  0,
   fakeclient_op_read:       false,  // osd!
   fakeclient_op_write:      false,  // osd!
   fakeclient_op_truncate:   false,
   fakeclient_op_fsync:      false,
-  fakeclient_op_close:    20
+  fakeclient_op_close:    200
 };
 
 
index c80e8f0e224fc8d71570b6d12aac6cac0e4419b1..7be0ba2724c225e1116fcce9c6565491fcf4b9e2 100644 (file)
@@ -46,38 +46,44 @@ int main(int oargc, char **oargv) {
   char **nargv = new pchar[argc];
   nargv[nargc++] = argv[0];
 
-  string syn_sarg1;
   list<int> syn_modes;
-  int syn_iarg1, syn_iarg2, syn_iarg3;
+  list<int> syn_iargs;
+  list<string> syn_sargs;
+  
   int mkfs = 0;
   for (int i=1; i<argc; i++) {
+       //cout << "a " << argv[i] << endl;
        if (strcmp(argv[i], "--fastmkfs") == 0) {
          mkfs = MDS_MKFS_FAST;
        }
        else if (strcmp(argv[i], "--fullmkfs") == 0) {
          mkfs = MDS_MKFS_FULL;
        }
-       else if (strcmp(argv[i],"--synsarg1") == 0) 
-         syn_sarg1 = argv[++i];
-       else if (strcmp(argv[i],"--syniarg1") == 0) 
-         syn_iarg1 = atoi(argv[++i]);
-       else if (strcmp(argv[i],"--syniarg2") == 0) 
-         syn_iarg2 = atoi(argv[++i]);
-       else if (strcmp(argv[i],"--syniarg3") == 0) 
-         syn_iarg3 = atoi(argv[++i]);
-       else if (strcmp(argv[i],"--synmode") == 0) {
+       else if (strcmp(argv[i],"--syn") == 0) {
          ++i;
-         if (strcmp(argv[i],"writefile") == 0) 
+         if (strcmp(argv[i],"writefile") == 0) {
                syn_modes.push_back( SYNCLIENT_MODE_WRITEFILE );
-         else if (strcmp(argv[i],"readfile") == 0) 
+               syn_iargs.push_back( atoi(argv[++i]) );
+               syn_iargs.push_back( atoi(argv[++i]) );
+         } else if (strcmp(argv[i],"readfile") == 0) {
                syn_modes.push_back( SYNCLIENT_MODE_READFILE );
-         else if (strcmp(argv[i],"makedirs") == 0) 
+               syn_iargs.push_back( atoi(argv[++i]) );
+               syn_iargs.push_back( atoi(argv[++i]) );
+         } else if (strcmp(argv[i],"makedirs") == 0) {
                syn_modes.push_back( SYNCLIENT_MODE_MAKEDIRS );
-         else if (strcmp(argv[i],"fullwalk") == 0) 
+               syn_iargs.push_back( atoi(argv[++i]) );
+               syn_iargs.push_back( atoi(argv[++i]) );
+               syn_iargs.push_back( atoi(argv[++i]) );
+         } else if (strcmp(argv[i],"fullwalk") == 0) {
                syn_modes.push_back( SYNCLIENT_MODE_FULLWALK );
-         else if (strcmp(argv[i],"randomwalk") == 0) 
+               //syn_sargs.push_back( atoi(argv[++i]) );
+         } else if (strcmp(argv[i],"randomwalk") == 0) {
                syn_modes.push_back( SYNCLIENT_MODE_RANDOMWALK );
-         else {
+               syn_iargs.push_back( atoi(argv[++i]) );
+         } else if (strcmp(argv[i],"until") == 0) {
+               syn_modes.push_back( SYNCLIENT_MODE_UNTIL );
+               syn_iargs.push_back( atoi(argv[++i]) );
+         } else {
                cerr << "unknown syn mode " << argv[i] << endl;
                return -1;
          }
@@ -167,14 +173,9 @@ int main(int oargc, char **oargv) {
          //cout << "starting synthetic client on rank " << myrank << endl;
          syn[i] = new SyntheticClient(client[i]);
 
-         char s[20];
-         sprintf(s,"syn.%d", i);
-         syn[i]->sarg1 = s;
-
          syn[i]->modes = syn_modes;
-         syn[i]->iarg1 = syn_iarg1;
-         syn[i]->iarg2 = syn_iarg2;
-         syn[i]->iarg3 = syn_iarg3;
+         syn[i]->sargs = syn_sargs;
+         syn[i]->iargs = syn_iargs;
          syn[i]->start_thread();
        }
        for (int i=0; i<NUMCLIENT; i++) {