示例#1
0
        static void Main(string[] args)
        {
            string ip   = "127.0.0.1";
            int    port = 3278;

            if (args.Length > 0 && args[0] != "-")
            {
                ip = args[0];
            }
            if (args.Length > 1 && args[1] != "-")
            {
                port = int.Parse(args[1]);
            }

            // Create a new client, use only blittable struct types here. Client can only communicate
            // with a server that uses the same (or bytewise compatible) blittable struct types. For
            // (long key, long value) is compatible with the FixedLenServer project.
            using var client = new FasterKVClient <long, long>(ip, port);

            // Create a client session to the FasterKV server.
            // Sessions are mono-threaded, similar to normal FasterKV sessions.
            using var session = client.NewSession(new Functions()); // Uses protocol WireFormat.DefaultFixedLenKV by default

            // Explicit version of NewSession call, where you provide all types, callback functions, and serializer
            // using var session = client.NewSession<long, long, byte, Functions, FixedLenSerializer<long, long, long, long>>(new Functions(), new FixedLenSerializer<long, long, long, long>());

            // Samples using sync client API
            SyncSamples(session);

            // Samples using async client API
            AsyncSamples(session).Wait();

            Console.WriteLine("Success!");
        }
示例#2
0
        public void Run(string ip, int port)
        {
            using var client1 = new FasterKVClient <ReadOnlyMemory <byte>, ReadOnlyMemory <byte> >(ip, port);
            var session = client1.NewSession(new MemoryFunctionsByte()); // uses protocol WireFormat.DefaultVarLenKV by default

            SyncMemoryBenchmark(session);
        }
示例#3
0
        public void Run(string ip, int port)
        {
            using var client1 = new FasterKVClient <ReadOnlyMemory <byte>, ReadOnlyMemory <byte> >(ip, port);
            var session = client1.NewSession(new MemoryFunctionsByte());

            SyncMemoryBenchmark(session);
        }
示例#4
0
        public void Run(string ip, int port)
        {
            using var client1 = new FasterKVClient <ReadOnlyMemory <int>, ReadOnlyMemory <int> >(ip, port);
            var session = client1.NewSession(new MemoryFunctions());

            SyncMemorySamples(session);
            AsyncMemorySamples(session).Wait();
        }
示例#5
0
        public void Run(string ip, int port)
        {
            using var client1 = new FasterKVClient <ReadOnlyMemory <int>, ReadOnlyMemory <int> >(ip, port);
            var session = client1.NewSession(new MemoryFunctions()); // uses protocol WireFormat.DefaultVarLenKV by default

            SyncMemorySamples(session);
            AsyncMemorySamples(session).Wait();
        }
示例#6
0
        public void Run(string ip, int port)
        {
            using var client = new FasterKVClient <CustomType, CustomType>(ip, port);

            // Create a session to FasterKV server
            // Sessions are mono-threaded, similar to normal FasterKV sessions
            using var session = client.NewSession(new CustomTypeFunctions(), WireFormat.DefaultVarLenKV);

            // Explicit version of NewSession call, where you provide all types, callback functions, and serializer
            // using var session = client.NewSession<long, long, long, Functions, BlittableParameterSerializer<long, long, long, long>>(new Functions(), new BlittableParameterSerializer<long, long, long, long>());

            // Samples using sync client API
            SyncVarLenSamples(session);

            // Samples using async client API
            AsyncVarLenSamples(session).Wait();
        }
示例#7
0
        public void Run(string ip, int port)
        {
            using var client = new FasterKVClient <CustomType, CustomType>(ip, port);

            // Create a session to FasterKV server
            // Sessions are mono-threaded, similar to normal FasterKV sessions
            var session    = client.NewSession(new CustomTypeFunctions(), WireFormat.DefaultVarLenKV);
            var subSession = client.NewSession(new CustomTypeFunctions(), WireFormat.DefaultVarLenKV);

            // Samples using sync client API
            SyncVarLenSamples(session);

            // Samples using sync client API
            SyncVarLenSubscriptionKVSamples(session, subSession);

            // Samples using sync client API
            SyncVarLenSubscriptionSamples(session, subSession);

            // Samples using async client API
            AsyncVarLenSamples(session).Wait();
        }
        public FASTER_YcsbBenchmark(int threadCount_, int numaStyle_, string distribution_, int readPercent_, string ipAddress_, int port_, bool skipSetup_)
        {
            threadCount  = threadCount_;
            numaStyle    = numaStyle_;
            distribution = distribution_;
            readPercent  = readPercent_;
            skipSetup    = skipSetup_;

#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

            store = new FasterKVClient <Key, Value>(ipAddress_, port_);
        }
示例#9
0
 public FixedLenClient(string address = "127.0.0.1", int port = 33278)
 {
     client = new FasterKVClient <long, long>(address, port);
 }
示例#10
0
 public VarLenMemoryClient(string address = "127.0.0.1", int port = 33278)
 {
     client = new FasterKVClient <ReadOnlyMemory <int>, ReadOnlyMemory <int> >(address, port);
 }