Beispiel #1
0
        internal FasterSpanByteYcsbBenchmark(KeySpanByte[] i_keys_, KeySpanByte[] t_keys_, TestLoader testLoader)
        {
            // Pin loading thread if it is not used for checkpointing
            if (YcsbConstants.kPeriodicCheckpointMilliseconds <= 0)
            {
                Native32.AffinitizeThreadShardedNuma(0, 2);
            }

            init_keys_  = i_keys_;
            txn_keys_   = t_keys_;
            numaStyle   = testLoader.Options.NumaStyle;
            readPercent = testLoader.Options.ReadPercent;
            var lockImpl = testLoader.LockImpl;

            functions = new FunctionsSB(lockImpl != LockImpl.None);

#if DASHBOARD
            statsWritten = new AutoResetEvent[threadCount];
            for (int i = 0; i < threadCount; i++)
            {
                statsWritten[i] = new AutoResetEvent(false);
            }
            threadThroughput     = new double[threadCount];
            threadAverageLatency = new double[threadCount];
            threadMaximumLatency = new double[threadCount];
            threadProgress       = new long[threadCount];
            writeStats           = new bool[threadCount];
            freq = Stopwatch.Frequency;
#endif

            input_ = new Input[8];
            for (int i = 0; i < 8; i++)
            {
                input_[i].value = i;
            }

            device = Devices.CreateLogDevice(TestLoader.DevicePath, preallocateFile: true);

            if (YcsbConstants.kSmallMemoryLog)
            {
                store = new FasterKV <SpanByte, SpanByte>
                            (YcsbConstants.kMaxKey / 2, new LogSettings {
                    LogDevice = device, PreallocateLog = true, PageSizeBits = 22, SegmentSizeBits = 26, MemorySizeBits = 26
                },
                            new CheckpointSettings {
                    CheckPointType = CheckpointType.Snapshot, CheckpointDir = testLoader.BackupPath
                });
            }
            else
            {
                store = new FasterKV <SpanByte, SpanByte>
                            (YcsbConstants.kMaxKey / 2, new LogSettings {
                    LogDevice = device, PreallocateLog = true, MemorySizeBits = 35
                },
                            new CheckpointSettings {
                    CheckPointType = CheckpointType.Snapshot, CheckpointDir = testLoader.BackupPath
                });
            }
        }
        internal FasterSpanByteYcsbBenchmark(KeySpanByte[] i_keys_, KeySpanByte[] t_keys_, TestLoader testLoader)
        {
            // Affinize main thread to last core on first socket if not used by experiment
            var(numGrps, numProcs) = Native32.GetNumGroupsProcsPerGroup();
            if ((testLoader.Options.NumaStyle == 0 && testLoader.Options.ThreadCount <= (numProcs - 1)) ||
                (testLoader.Options.NumaStyle == 1 && testLoader.Options.ThreadCount <= numGrps * (numProcs - 1)))
            {
                Native32.AffinitizeThreadRoundRobin(numProcs - 1);
            }

            init_keys_  = i_keys_;
            txn_keys_   = t_keys_;
            numaStyle   = testLoader.Options.NumaStyle;
            readPercent = testLoader.Options.ReadPercent;
            var lockImpl = testLoader.LockImpl;

            functions = new FunctionsSB(lockImpl != LockImpl.None);

#if DASHBOARD
            statsWritten = new AutoResetEvent[threadCount];
            for (int i = 0; i < threadCount; i++)
            {
                statsWritten[i] = new AutoResetEvent(false);
            }
            threadThroughput     = new double[threadCount];
            threadAverageLatency = new double[threadCount];
            threadMaximumLatency = new double[threadCount];
            threadProgress       = new long[threadCount];
            writeStats           = new bool[threadCount];
            freq = Stopwatch.Frequency;
#endif

            input_ = new Input[8];
            for (int i = 0; i < 8; i++)
            {
                input_[i].value = i;
            }

            device = Devices.CreateLogDevice(TestLoader.DevicePath, preallocateFile: true, deleteOnClose: true);

            if (YcsbConstants.kSmallMemoryLog)
            {
                store = new FasterKV <SpanByte, SpanByte>
                            (YcsbConstants.kMaxKey / 2, new LogSettings {
                    LogDevice = device, PreallocateLog = true, PageSizeBits = 22, SegmentSizeBits = 26, MemorySizeBits = 26
                },
                            new CheckpointSettings {
                    CheckPointType = CheckpointType.Snapshot, CheckpointDir = testLoader.BackupPath
                });
            }
            else
            {
                store = new FasterKV <SpanByte, SpanByte>
                            (YcsbConstants.kMaxKey / 2, new LogSettings {
                    LogDevice = device, PreallocateLog = true, MemorySizeBits = 35
                },
                            new CheckpointSettings {
                    CheckPointType = CheckpointType.Snapshot, CheckpointDir = testLoader.BackupPath
                });
            }
        }