diff --git a/lib/cpp/test/concurrency/Tests.cpp b/lib/cpp/test/concurrency/Tests.cpp
index 33af392..f49bb9f 100644
--- a/lib/cpp/test/concurrency/Tests.cpp
+++ b/lib/cpp/test/concurrency/Tests.cpp
@@ -25,6 +25,10 @@
 #include "TimerManagerTests.h"
 #include "ThreadManagerTests.h"
 
+// The test weight, where 10 is 10 times more threads than baseline
+// and the baseline is optimized for running in valgrind
+static size_t WEIGHT = 10;
+
 int main(int argc, char** argv) {
 
   std::string arg;
@@ -37,6 +41,11 @@
     args[ix - 1] = std::string(argv[ix]);
   }
 
+  if (getenv("VALGRIND") != 0) {
+	  // lower the scale of every test
+	  WEIGHT = 1;
+  }
+  
   bool runAll = args[0].compare("all") == 0;
 
   if (runAll || args[0].compare("thread-factory") == 0) {
@@ -45,10 +54,10 @@
 
     std::cout << "ThreadFactory tests..." << std::endl;
 
-    int reapLoops = 20;
-    int reapCount = 1000;
+    int reapLoops = 2 * WEIGHT;
+    int reapCount = 100 * WEIGHT;
     size_t floodLoops = 3;
-    size_t floodCount = 20000;
+    size_t floodCount = 500 * WEIGHT;
 
     std::cout << "\t\tThreadFactory reap N threads test: N = " << reapLoops << "x" << reapCount << std::endl;
 
@@ -121,8 +130,8 @@
     std::cout << "ThreadManager tests..." << std::endl;
 
     {
-      size_t workerCount = 100;
-      size_t taskCount = 50000;
+      size_t workerCount = 10 * WEIGHT;
+      size_t taskCount = 500 * WEIGHT;
       int64_t delay = 10LL;
 
       ThreadManagerTests threadManagerTests;
@@ -160,13 +169,13 @@
 
       size_t minWorkerCount = 2;
 
-      size_t maxWorkerCount = 64;
+      size_t maxWorkerCount = 8;
 
-      size_t tasksPerWorker = 1000;
+      size_t tasksPerWorker = 100 * WEIGHT;
 
       int64_t delay = 5LL;
 
-      for (size_t workerCount = minWorkerCount; workerCount < maxWorkerCount; workerCount *= 4) {
+      for (size_t workerCount = minWorkerCount; workerCount <= maxWorkerCount; workerCount *= 4) {
 
         size_t taskCount = workerCount * tasksPerWorker;
 
diff --git a/lib/cpp/test/concurrency/ThreadFactoryTests.h b/lib/cpp/test/concurrency/ThreadFactoryTests.h
index bd6ed32..6ac9aa5 100644
--- a/lib/cpp/test/concurrency/ThreadFactoryTests.h
+++ b/lib/cpp/test/concurrency/ThreadFactoryTests.h
@@ -21,11 +21,12 @@
 #include <thrift/concurrency/Thread.h>
 #include <thrift/concurrency/PlatformThreadFactory.h>
 #include <thrift/concurrency/Monitor.h>
+#include <thrift/concurrency/Mutex.h>
 #include <thrift/concurrency/Util.h>
 
 #include <assert.h>
 #include <iostream>
-#include <set>
+#include <vector>
 
 namespace apache {
 namespace thrift {
@@ -78,13 +79,13 @@
 
       int* activeCount = new int(count);
 
-      std::set<shared_ptr<Thread> > threads;
+      std::vector<shared_ptr<Thread> > threads;
 
       int tix;
 
       for (tix = 0; tix < count; tix++) {
         try {
-          threads.insert(
+          threads.push_back(
               threadFactory.newThread(shared_ptr<Runnable>(new ReapNTask(*monitor, *activeCount))));
         } catch (SystemResourceException& e) {
           std::cout << "\t\t\tfailed to create " << lix* count + tix << " thread " << e.what()
@@ -94,7 +95,7 @@
       }
 
       tix = 0;
-      for (std::set<shared_ptr<Thread> >::const_iterator thread = threads.begin();
+      for (std::vector<shared_ptr<Thread> >::const_iterator thread = threads.begin();
            thread != threads.end();
            tix++, ++thread) {
 
@@ -113,6 +114,7 @@
           monitor->wait(1000);
         }
       }
+      
       delete activeCount;
       std::cout << "\t\t\treaped " << lix* count << " threads" << std::endl;
     }
@@ -253,19 +255,22 @@
 
   class FloodTask : public Runnable {
   public:
-    FloodTask(const size_t id) : _id(id) {}
+    FloodTask(const size_t id, Monitor& mon) : _id(id), _mon(mon) {}
     ~FloodTask() {
       if (_id % 10000 == 0) {
+		Synchronized sync(_mon);
         std::cout << "\t\tthread " << _id << " done" << std::endl;
       }
     }
 
     void run() {
       if (_id % 10000 == 0) {
+		Synchronized sync(_mon);
         std::cout << "\t\tthread " << _id << " started" << std::endl;
       }
     }
     const size_t _id;
+    Monitor& _mon;
   };
 
   void foo(PlatformThreadFactory* tf) { (void)tf; }
@@ -273,7 +278,8 @@
   bool floodNTest(size_t loop = 1, size_t count = 100000) {
 
     bool success = false;
-
+    Monitor mon;
+	
     for (size_t lix = 0; lix < loop; lix++) {
 
       PlatformThreadFactory threadFactory = PlatformThreadFactory();
@@ -283,10 +289,8 @@
 
         try {
 
-          shared_ptr<FloodTask> task(new FloodTask(lix * count + tix));
-
+          shared_ptr<FloodTask> task(new FloodTask(lix * count + tix, mon));
           shared_ptr<Thread> thread = threadFactory.newThread(task);
-
           thread->start();
 
         } catch (TException& e) {
@@ -298,8 +302,8 @@
         }
       }
 
+      Synchronized sync(mon);
       std::cout << "\t\t\tflooded " << (lix + 1) * count << " threads" << std::endl;
-
       success = true;
     }
 
diff --git a/lib/cpp/test/concurrency/ThreadManagerTests.h b/lib/cpp/test/concurrency/ThreadManagerTests.h
index c07a21b..9ecd6ba 100644
--- a/lib/cpp/test/concurrency/ThreadManagerTests.h
+++ b/lib/cpp/test/concurrency/ThreadManagerTests.h
@@ -109,7 +109,7 @@
     shared_ptr<ThreadManager> threadManager = ThreadManager::newSimpleThreadManager(workerCount);
 
     shared_ptr<PlatformThreadFactory> threadFactory
-        = shared_ptr<PlatformThreadFactory>(new PlatformThreadFactory());
+        = shared_ptr<PlatformThreadFactory>(new PlatformThreadFactory(false));
 
 #if !USE_BOOST_THREAD && !USE_STD_THREAD
     threadFactory->setPriority(PosixThreadFactory::HIGHEST);
