@@ -0,0 +1,2965 @@
+package peergos.server.tests.slow;%0A%0Aimport org.junit.*;%0Aimport org.junit.runner.*;%0Aimport org.junit.runners.*;%0Aimport peergos.server.*;%0Aimport peergos.server.tests.*;%0Aimport peergos.server.util.*;%0Aimport peergos.shared.*;%0Aimport peergos.shared.storage.*;%0Aimport peergos.shared.user.*;%0A%0Aimport java.net.*;%0Aimport java.util.*;%0A%0A@RunWith(Parameterized.class)%0Apublic class MultipartBenchmark %7B%0A%0A    private static int RANDOM_SEED = 666;%0A    private final NetworkAccess network;%0A    private final Crypto crypto = Crypto.initJava();%0A%0A    private static Random random = new Random(RANDOM_SEED);%0A%0A    public MultipartBenchmark(String useIPFS, Random r) throws Exception %7B%0A        this.network = buildHttpNetworkAccess(useIPFS.equals(%22IPFS%22), r);%0A    %7D%0A%0A    private static NetworkAccess buildHttpNetworkAccess(boolean useIpfs, Random r) throws Exception %7B%0A        Args args = UserTests.buildArgs().with(%22useIPFS%22, %22%22 + useIpfs);%0A        Main.PKI_INIT.main(args);%0A        return NetworkAccess.buildJava(new URL(%22http://localhost:%22 + args.getInt(%22port%22))).get();%0A    %7D%0A%0A    @Parameterized.Parameters()%0A    public static Collection%3CObject%5B%5D%3E parameters() %7B%0A        return Arrays.asList(new Object%5B%5D%5B%5D %7B%0A//                %7B%22IPFS%22, new Random(0)%7D%0A                %7B%22NOTIPFS%22, new Random(0)%7D%0A        %7D);%0A    %7D%0A%0A    private String generateUsername() %7B%0A        return %22test%22 + (random.nextInt() %25 10000);%0A    %7D%0A%0A    public static UserContext ensureSignedUp(String username, String password, NetworkAccess network, Crypto crypto) throws Exception %7B%0A        return UserContext.ensureSignedUp(username, password, network, crypto).get();%0A    %7D%0A%0A    // 70 KB/S throughput%0A    @Test%0A    public void smallFragments() throws Exception %7B%0A        testWriteThroughput(4096);%0A    %7D%0A%0A    // 1500 KB/S throughput%0A    @Test%0A    public void largeFragments() throws Exception %7B%0A        testWriteThroughput(128*1024);%0A    %7D%0A%0A    public void testWriteThroughput(int fragmentSize) throws Exception %7B%0A        String username = generateUsername();%0A        String password = %22test01%22;%0A        UserContext context = ensureSignedUp(username, password, network, crypto);%0A%0A        long worst = 0, best = Long.MAX_VALUE, start = System.currentTimeMillis();%0A        TransactionId tid = network.dhtClient.startTransaction(context.signer.publicKeyHash).join();%0A        byte%5B%5D data = new byte%5BfragmentSize%5D;%0A        for (int i=0; i %3C 10000; i++) %7B%0A            random.nextBytes(data);%0A            long t1 = System.currentTimeMillis();%0A            network.dhtClient.put(context.signer.publicKeyHash, context.signer, data, tid).join();%0A            long duration = System.currentTimeMillis() - t1;%0A            worst = Math.max(worst, duration);%0A            best = Math.min(best, duration);%0A            System.err.printf(%22PUT(%25d) duration: %25d mS, best: %25d mS, worst: %25d mS, av: %25d mS %25d KB/S%5Cn%22, i,%0A                    duration, best, worst, (t1 + duration - start) / (i + 1), data.length / duration);%0A        %7D%0A    %7D%0A%7D%0A

Add benchmark for multipart puts