Search in sources :

Example 6 with ServiceBuilder

use of io.pravega.segmentstore.server.store.ServiceBuilder in project pravega by pravega.

the class ReaderGroupTest method testEventHandoff.

@Test(timeout = 20000)
public void testEventHandoff() throws Exception {
    String endpoint = "localhost";
    int servicePort = TestUtils.getAvailableListenPort();
    @Cleanup ServiceBuilder serviceBuilder = ServiceBuilder.newInMemoryBuilder(ServiceBuilderConfig.getDefaultConfig());
    serviceBuilder.initialize();
    StreamSegmentStore store = serviceBuilder.createStreamSegmentService();
    @Cleanup PravegaConnectionListener server = new PravegaConnectionListener(false, servicePort, store);
    server.startListening();
    @Cleanup MockStreamManager streamManager = new MockStreamManager(SCOPE, endpoint, servicePort);
    streamManager.createScope(SCOPE);
    streamManager.createStream(SCOPE, STREAM_NAME, StreamConfiguration.builder().scope(SCOPE).streamName(STREAM_NAME).scalingPolicy(ScalingPolicy.fixed(2)).build());
    @Cleanup MockClientFactory clientFactory = streamManager.getClientFactory();
    ReaderGroupConfig groupConfig = ReaderGroupConfig.builder().automaticCheckpointIntervalMillis(-1).stream(Stream.of(SCOPE, STREAM_NAME)).build();
    streamManager.createReaderGroup(READER_GROUP, groupConfig);
    writeEvents(100, clientFactory);
    ReaderThread r1 = new ReaderThread(20, "Reader1", clientFactory);
    ReaderThread r2 = new ReaderThread(80, "Reader2", clientFactory);
    Thread reader1Thread = new Thread(r1);
    Thread reader2Thread = new Thread(r2);
    reader1Thread.start();
    reader2Thread.start();
    reader1Thread.join();
    reader2Thread.join();
    if (r1.exception.get() != null) {
        throw r1.exception.get();
    }
    if (r2.exception.get() != null) {
        throw r2.exception.get();
    }
    streamManager.deleteReaderGroup(READER_GROUP);
}
Also used : ReaderGroupConfig(io.pravega.client.stream.ReaderGroupConfig) StreamSegmentStore(io.pravega.segmentstore.contracts.StreamSegmentStore) MockStreamManager(io.pravega.client.stream.mock.MockStreamManager) Cleanup(lombok.Cleanup) PravegaConnectionListener(io.pravega.segmentstore.server.host.handler.PravegaConnectionListener) MockClientFactory(io.pravega.client.stream.mock.MockClientFactory) ServiceBuilder(io.pravega.segmentstore.server.store.ServiceBuilder) Test(org.junit.Test)

Example 7 with ServiceBuilder

use of io.pravega.segmentstore.server.store.ServiceBuilder in project pravega by pravega.

the class EventProcessorTest method testEventProcessor.

@Test(timeout = 60000)
public void testEventProcessor() throws Exception {
    @Cleanup TestingServer zkTestServer = new TestingServerStarter().start();
    ServiceBuilder serviceBuilder = ServiceBuilder.newInMemoryBuilder(ServiceBuilderConfig.getDefaultConfig());
    serviceBuilder.initialize();
    StreamSegmentStore store = serviceBuilder.createStreamSegmentService();
    int servicePort = TestUtils.getAvailableListenPort();
    @Cleanup PravegaConnectionListener server = new PravegaConnectionListener(false, servicePort, store);
    server.startListening();
    int controllerPort = TestUtils.getAvailableListenPort();
    @Cleanup ControllerWrapper controllerWrapper = new ControllerWrapper(zkTestServer.getConnectString(), true, controllerPort, "localhost", servicePort, 4);
    controllerWrapper.awaitRunning();
    Controller controller = controllerWrapper.getController();
    // Create controller object for testing against a separate controller process.
    // ControllerImpl controller = new ControllerImpl("localhost", 9090);
    final String host = "host";
    final String scope = "controllerScope";
    final String streamName = "stream1";
    final String readerGroup = "readerGroup";
    final CompletableFuture<Boolean> createScopeStatus = controller.createScope(scope);
    if (!createScopeStatus.join()) {
        throw new RuntimeException("Scope already existed");
    }
    final StreamConfiguration config = StreamConfiguration.builder().scope(scope).streamName(streamName).scalingPolicy(ScalingPolicy.fixed(1)).build();
    System.err.println(String.format("Creating stream (%s, %s)", scope, streamName));
    CompletableFuture<Boolean> createStatus = controller.createStream(config);
    if (!createStatus.get()) {
        System.err.println("Stream alrady existed, exiting");
        return;
    }
    @Cleanup ConnectionFactoryImpl connectionFactory = new ConnectionFactoryImpl(ClientConfig.builder().build());
    @Cleanup ClientFactory clientFactory = new ClientFactoryImpl(scope, controller, connectionFactory);
    @Cleanup EventStreamWriter<TestEvent> producer = clientFactory.createEventWriter(streamName, new JavaSerializer<>(), EventWriterConfig.builder().build());
    int[] input = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
    int expectedSum = input.length * (input.length + 1) / 2;
    for (int i = 0; i < input.length; i++) {
        producer.writeEvent("key", new TestEvent(input[i]));
    }
    producer.writeEvent("key", new TestEvent(-1));
    producer.flush();
    EventProcessorSystem system = new EventProcessorSystemImpl("Controller", host, scope, new ClientFactoryImpl(scope, controller, connectionFactory), new ReaderGroupManagerImpl(scope, controller, clientFactory, connectionFactory));
    CheckpointConfig.CheckpointPeriod period = CheckpointConfig.CheckpointPeriod.builder().numEvents(1).numSeconds(1).build();
    CheckpointConfig checkpointConfig = CheckpointConfig.builder().type(CheckpointConfig.Type.Periodic).checkpointPeriod(period).build();
    EventProcessorGroupConfig eventProcessorGroupConfig = EventProcessorGroupConfigImpl.builder().eventProcessorCount(1).readerGroupName(readerGroup).streamName(streamName).checkpointConfig(checkpointConfig).build();
    CompletableFuture<Long> result = new CompletableFuture<>();
    // Test case 1. Actor does not throw any exception during normal operation.
    EventProcessorConfig<TestEvent> eventProcessorConfig = EventProcessorConfig.<TestEvent>builder().supplier(() -> new TestEventProcessor(false, result)).serializer(new JavaSerializer<>()).decider((Throwable e) -> ExceptionHandler.Directive.Stop).config(eventProcessorGroupConfig).build();
    @Cleanup EventProcessorGroup<TestEvent> eventProcessorGroup = system.createEventProcessorGroup(eventProcessorConfig, CheckpointStoreFactory.createInMemoryStore());
    Long value = result.join();
    Assert.assertEquals(expectedSum, value.longValue());
    log.info("SUCCESS: received expected sum = " + expectedSum);
}
Also used : EventProcessorSystem(io.pravega.controller.eventProcessor.EventProcessorSystem) ClientFactory(io.pravega.client.ClientFactory) Cleanup(lombok.Cleanup) PravegaConnectionListener(io.pravega.segmentstore.server.host.handler.PravegaConnectionListener) JavaSerializer(io.pravega.client.stream.impl.JavaSerializer) ServiceBuilder(io.pravega.segmentstore.server.store.ServiceBuilder) ClientFactoryImpl(io.pravega.client.stream.impl.ClientFactoryImpl) CompletableFuture(java.util.concurrent.CompletableFuture) StreamConfiguration(io.pravega.client.stream.StreamConfiguration) ReaderGroupManagerImpl(io.pravega.client.admin.impl.ReaderGroupManagerImpl) ControllerWrapper(io.pravega.test.integration.demo.ControllerWrapper) TestingServer(org.apache.curator.test.TestingServer) TestingServerStarter(io.pravega.test.common.TestingServerStarter) CheckpointConfig(io.pravega.controller.eventProcessor.CheckpointConfig) Controller(io.pravega.client.stream.impl.Controller) EventProcessorSystemImpl(io.pravega.controller.eventProcessor.impl.EventProcessorSystemImpl) StreamSegmentStore(io.pravega.segmentstore.contracts.StreamSegmentStore) EventProcessorGroupConfig(io.pravega.controller.eventProcessor.EventProcessorGroupConfig) ConnectionFactoryImpl(io.pravega.client.netty.impl.ConnectionFactoryImpl) Test(org.junit.Test)

Example 8 with ServiceBuilder

use of io.pravega.segmentstore.server.store.ServiceBuilder in project pravega by pravega.

the class ScaleTest method main.

public static void main(String[] args) throws Exception {
    try {
        ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor();
        @Cleanup TestingServer zkTestServer = new TestingServerStarter().start();
        ServiceBuilder serviceBuilder = ServiceBuilder.newInMemoryBuilder(ServiceBuilderConfig.getDefaultConfig());
        serviceBuilder.initialize();
        StreamSegmentStore store = serviceBuilder.createStreamSegmentService();
        int port = Config.SERVICE_PORT;
        @Cleanup PravegaConnectionListener server = new PravegaConnectionListener(false, port, store);
        server.startListening();
        // Create controller object for testing against a separate controller report.
        @Cleanup ControllerWrapper controllerWrapper = new ControllerWrapper(zkTestServer.getConnectString(), port);
        Controller controller = controllerWrapper.getController();
        final String scope = "scope";
        controllerWrapper.getControllerService().createScope(scope).get();
        final String streamName = "stream1";
        final StreamConfiguration config = StreamConfiguration.builder().scope(scope).streamName(streamName).scalingPolicy(ScalingPolicy.fixed(1)).build();
        Stream stream = new StreamImpl(scope, streamName);
        log.info("Creating stream {}/{}", scope, streamName);
        if (!controller.createStream(config).get()) {
            log.error("Stream already existed, exiting");
            return;
        }
        // Test 1: scale stream: split one segment into two
        log.info("Scaling stream {}/{}, splitting one segment into two", scope, streamName);
        Map<Double, Double> map = new HashMap<>();
        map.put(0.0, 0.5);
        map.put(0.5, 1.0);
        if (!controller.scaleStream(stream, Collections.singletonList(0), map, executor).getFuture().get()) {
            log.error("Scale stream: splitting segment into two failed, exiting");
            return;
        }
        // Test 2: scale stream: merge two segments into one
        log.info("Scaling stream {}/{}, merging two segments into one", scope, streamName);
        CompletableFuture<Boolean> scaleResponseFuture = controller.scaleStream(stream, Arrays.asList(1, 2), Collections.singletonMap(0.0, 1.0), executor).getFuture();
        if (!scaleResponseFuture.get()) {
            log.error("Scale stream: merging two segments into one failed, exiting");
            return;
        }
        // Test 3: create a transaction, and try scale operation, it should fail with precondition check failure
        CompletableFuture<TxnSegments> txnFuture = controller.createTransaction(stream, 5000, 29000);
        TxnSegments transaction = txnFuture.get();
        if (transaction == null) {
            log.error("Create transaction failed, exiting");
            return;
        }
        log.info("Scaling stream {}/{}, splitting one segment into two, while transaction is ongoing", scope, streamName);
        scaleResponseFuture = controller.scaleStream(stream, Collections.singletonList(3), map, executor).getFuture();
        CompletableFuture<Boolean> future = scaleResponseFuture.whenComplete((r, e) -> {
            if (e != null) {
                log.error("Failed: scale with ongoing transaction.", e);
            } else if (getAndHandleExceptions(controller.checkTransactionStatus(stream, transaction.getTxnId()), RuntimeException::new) != Transaction.Status.OPEN) {
                log.info("Success: scale with ongoing transaction.");
            } else {
                log.error("Failed: scale with ongoing transaction.");
            }
        });
        CompletableFuture<Void> statusFuture = controller.abortTransaction(stream, transaction.getTxnId());
        statusFuture.get();
        future.get();
        log.info("All scaling test PASSED");
        executor.shutdown();
        System.exit(0);
    } catch (Throwable t) {
        log.error("test failed with {}", t);
        System.exit(-1);
    }
}
Also used : HashMap(java.util.HashMap) Cleanup(lombok.Cleanup) PravegaConnectionListener(io.pravega.segmentstore.server.host.handler.PravegaConnectionListener) ServiceBuilder(io.pravega.segmentstore.server.store.ServiceBuilder) StreamConfiguration(io.pravega.client.stream.StreamConfiguration) Stream(io.pravega.client.stream.Stream) TestingServer(org.apache.curator.test.TestingServer) ScheduledExecutorService(java.util.concurrent.ScheduledExecutorService) TxnSegments(io.pravega.client.stream.impl.TxnSegments) TestingServerStarter(io.pravega.test.common.TestingServerStarter) Controller(io.pravega.client.stream.impl.Controller) StreamSegmentStore(io.pravega.segmentstore.contracts.StreamSegmentStore) StreamImpl(io.pravega.client.stream.impl.StreamImpl)

Example 9 with ServiceBuilder

use of io.pravega.segmentstore.server.store.ServiceBuilder in project pravega by pravega.

the class EndToEndAutoScaleUpWithTxnTest method main.

public static void main(String[] args) throws Exception {
    try {
        @Cleanup TestingServer zkTestServer = new TestingServerStarter().start();
        int port = Config.SERVICE_PORT;
        @Cleanup ControllerWrapper controllerWrapper = new ControllerWrapper(zkTestServer.getConnectString(), port);
        Controller controller = controllerWrapper.getController();
        controllerWrapper.getControllerService().createScope(NameUtils.INTERNAL_SCOPE_NAME).get();
        @Cleanup ConnectionFactory connectionFactory = new ConnectionFactoryImpl(ClientConfig.builder().build());
        @Cleanup ClientFactory internalCF = new ClientFactoryImpl(NameUtils.INTERNAL_SCOPE_NAME, controller, connectionFactory);
        ServiceBuilder serviceBuilder = ServiceBuilder.newInMemoryBuilder(ServiceBuilderConfig.getDefaultConfig());
        serviceBuilder.initialize();
        StreamSegmentStore store = serviceBuilder.createStreamSegmentService();
        @Cleanup SegmentStatsFactory segmentStatsFactory = new SegmentStatsFactory();
        SegmentStatsRecorder statsRecorder = segmentStatsFactory.createSegmentStatsRecorder(store, internalCF, AutoScalerConfig.builder().with(AutoScalerConfig.MUTE_IN_SECONDS, 0).with(AutoScalerConfig.COOLDOWN_IN_SECONDS, 0).build());
        @Cleanup PravegaConnectionListener server = new PravegaConnectionListener(false, "localhost", 12345, store, statsRecorder, null, null, null);
        server.startListening();
        controllerWrapper.awaitRunning();
        controllerWrapper.getControllerService().createScope("test").get();
        controller.createStream(CONFIG).get();
        @Cleanup MockClientFactory clientFactory = new MockClientFactory("test", controller);
        // Mocking pravega service by putting scale up and scale down requests for the stream
        EventWriterConfig writerConfig = EventWriterConfig.builder().transactionTimeoutTime(30000).transactionTimeoutScaleGracePeriod(30000).build();
        EventStreamWriter<String> test = clientFactory.createEventWriter("test", new JavaSerializer<>(), writerConfig);
        // region Successful commit tests
        Transaction<String> txn1 = test.beginTxn();
        txn1.writeEvent("1");
        txn1.flush();
        Map<Double, Double> map = new HashMap<>();
        map.put(0.0, 1.0 / 3.0);
        map.put(1.0 / 3.0, 2.0 / 3.0);
        map.put(2.0 / 3.0, 1.0);
        Stream stream = new StreamImpl("test", "test");
        ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor();
        controller.scaleStream(stream, Collections.singletonList(0), map, executor).getFuture().get();
        Transaction<String> txn2 = test.beginTxn();
        txn2.writeEvent("2");
        txn2.flush();
        txn2.commit();
        txn1.commit();
        Thread.sleep(1000);
        @Cleanup ReaderGroupManager readerGroupManager = new ReaderGroupManagerImpl("test", controller, clientFactory, connectionFactory);
        readerGroupManager.createReaderGroup("readergrp", ReaderGroupConfig.builder().stream("test").build());
        final EventStreamReader<String> reader = clientFactory.createReader("1", "readergrp", new JavaSerializer<>(), ReaderConfig.builder().build());
        String event1 = reader.readNextEvent(SECONDS.toMillis(60)).getEvent();
        String event2 = reader.readNextEvent(SECONDS.toMillis(60)).getEvent();
        assert event1.equals("1");
        assert event2.equals("2");
        final AtomicBoolean done = new AtomicBoolean(false);
        startWriter(test, done);
        Retry.withExpBackoff(10, 10, 100, 10000).retryingOn(NotDoneException.class).throwingOn(RuntimeException.class).runAsync(() -> controller.getCurrentSegments("test", "test").thenAccept(streamSegments -> {
            if (streamSegments.getSegments().size() > 3) {
                System.err.println("Success");
                log.info("Success");
                System.exit(0);
            } else {
                throw new NotDoneException();
            }
        }), Executors.newSingleThreadScheduledExecutor()).exceptionally(e -> {
            System.err.println("Failure");
            log.error("Failure");
            System.exit(1);
            return null;
        }).get();
    } catch (Throwable e) {
        System.err.print("Test failed with exception: " + e.getMessage());
        log.error("Test failed with exception: {}", e);
        System.exit(-1);
    }
    System.exit(0);
}
Also used : SegmentStatsFactory(io.pravega.segmentstore.server.host.stat.SegmentStatsFactory) EventStreamWriter(io.pravega.client.stream.EventStreamWriter) StreamImpl(io.pravega.client.stream.impl.StreamImpl) Retry(io.pravega.common.util.Retry) ReaderGroupManagerImpl(io.pravega.client.admin.impl.ReaderGroupManagerImpl) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) Cleanup(lombok.Cleanup) HashMap(java.util.HashMap) CompletableFuture(java.util.concurrent.CompletableFuture) JavaSerializer(io.pravega.client.stream.impl.JavaSerializer) StreamConfiguration(io.pravega.client.stream.StreamConfiguration) ServiceBuilderConfig(io.pravega.segmentstore.server.store.ServiceBuilderConfig) ServiceBuilder(io.pravega.segmentstore.server.store.ServiceBuilder) ClientFactoryImpl(io.pravega.client.stream.impl.ClientFactoryImpl) ReaderGroupManager(io.pravega.client.admin.ReaderGroupManager) TestingServerStarter(io.pravega.test.common.TestingServerStarter) Stream(io.pravega.client.stream.Stream) Map(java.util.Map) SegmentStatsRecorder(io.pravega.segmentstore.server.host.stat.SegmentStatsRecorder) ScheduledExecutorService(java.util.concurrent.ScheduledExecutorService) TestingServer(org.apache.curator.test.TestingServer) ConnectionFactory(io.pravega.client.netty.impl.ConnectionFactory) PravegaConnectionListener(io.pravega.segmentstore.server.host.handler.PravegaConnectionListener) Transaction(io.pravega.client.stream.Transaction) ReaderGroupConfig(io.pravega.client.stream.ReaderGroupConfig) StreamSegmentStore(io.pravega.segmentstore.contracts.StreamSegmentStore) EventWriterConfig(io.pravega.client.stream.EventWriterConfig) AutoScalerConfig(io.pravega.segmentstore.server.host.stat.AutoScalerConfig) NameUtils(io.pravega.shared.NameUtils) EventStreamReader(io.pravega.client.stream.EventStreamReader) Executors(java.util.concurrent.Executors) Slf4j(lombok.extern.slf4j.Slf4j) Config(io.pravega.controller.util.Config) ConnectionFactoryImpl(io.pravega.client.netty.impl.ConnectionFactoryImpl) ClientFactory(io.pravega.client.ClientFactory) ReaderConfig(io.pravega.client.stream.ReaderConfig) Controller(io.pravega.client.stream.impl.Controller) Collections(java.util.Collections) ScalingPolicy(io.pravega.client.stream.ScalingPolicy) MockClientFactory(io.pravega.client.stream.mock.MockClientFactory) SECONDS(java.util.concurrent.TimeUnit.SECONDS) ClientConfig(io.pravega.client.ClientConfig) SegmentStatsRecorder(io.pravega.segmentstore.server.host.stat.SegmentStatsRecorder) HashMap(java.util.HashMap) ClientFactory(io.pravega.client.ClientFactory) MockClientFactory(io.pravega.client.stream.mock.MockClientFactory) SegmentStatsFactory(io.pravega.segmentstore.server.host.stat.SegmentStatsFactory) Cleanup(lombok.Cleanup) PravegaConnectionListener(io.pravega.segmentstore.server.host.handler.PravegaConnectionListener) MockClientFactory(io.pravega.client.stream.mock.MockClientFactory) ServiceBuilder(io.pravega.segmentstore.server.store.ServiceBuilder) ConnectionFactory(io.pravega.client.netty.impl.ConnectionFactory) ClientFactoryImpl(io.pravega.client.stream.impl.ClientFactoryImpl) Stream(io.pravega.client.stream.Stream) ReaderGroupManagerImpl(io.pravega.client.admin.impl.ReaderGroupManagerImpl) TestingServer(org.apache.curator.test.TestingServer) ScheduledExecutorService(java.util.concurrent.ScheduledExecutorService) ReaderGroupManager(io.pravega.client.admin.ReaderGroupManager) TestingServerStarter(io.pravega.test.common.TestingServerStarter) Controller(io.pravega.client.stream.impl.Controller) StreamSegmentStore(io.pravega.segmentstore.contracts.StreamSegmentStore) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) EventWriterConfig(io.pravega.client.stream.EventWriterConfig) StreamImpl(io.pravega.client.stream.impl.StreamImpl) ConnectionFactoryImpl(io.pravega.client.netty.impl.ConnectionFactoryImpl)

Example 10 with ServiceBuilder

use of io.pravega.segmentstore.server.store.ServiceBuilder in project pravega by pravega.

the class StartLocalService method main.

public static void main(String[] args) throws Exception {
    @Cleanup ServiceBuilder serviceBuilder = ServiceBuilder.newInMemoryBuilder(ServiceBuilderConfig.getDefaultConfig());
    serviceBuilder.initialize();
    StreamSegmentStore store = serviceBuilder.createStreamSegmentService();
    @Cleanup PravegaConnectionListener server = new PravegaConnectionListener(false, StartLocalService.SERVICE_PORT, store);
    server.startListening();
    @Cleanup MockStreamManager streamManager = new MockStreamManager(SCOPE, "localhost", StartLocalService.SERVICE_PORT);
    streamManager.createScope(SCOPE);
    streamManager.createStream(SCOPE, STREAM_NAME, null);
    Thread.sleep(60000);
    System.exit(0);
}
Also used : StreamSegmentStore(io.pravega.segmentstore.contracts.StreamSegmentStore) MockStreamManager(io.pravega.client.stream.mock.MockStreamManager) Cleanup(lombok.Cleanup) PravegaConnectionListener(io.pravega.segmentstore.server.host.handler.PravegaConnectionListener) ServiceBuilder(io.pravega.segmentstore.server.store.ServiceBuilder)

Aggregations

ServiceBuilder (io.pravega.segmentstore.server.store.ServiceBuilder)26 StreamSegmentStore (io.pravega.segmentstore.contracts.StreamSegmentStore)25 Cleanup (lombok.Cleanup)20 PravegaConnectionListener (io.pravega.segmentstore.server.host.handler.PravegaConnectionListener)19 Test (org.junit.Test)15 TestingServerStarter (io.pravega.test.common.TestingServerStarter)11 MockClientFactory (io.pravega.client.stream.mock.MockClientFactory)9 StreamConfiguration (io.pravega.client.stream.StreamConfiguration)8 Controller (io.pravega.client.stream.impl.Controller)8 MockStreamManager (io.pravega.client.stream.mock.MockStreamManager)7 TestingServer (org.apache.curator.test.TestingServer)7 ReaderGroupConfig (io.pravega.client.stream.ReaderGroupConfig)6 SynchronousStreamSegmentStore (io.pravega.segmentstore.server.mocks.SynchronousStreamSegmentStore)6 WireCommands (io.pravega.shared.protocol.netty.WireCommands)6 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)6 InOrder (org.mockito.InOrder)6 ConnectionFactoryImpl (io.pravega.client.netty.impl.ConnectionFactoryImpl)5 ScalingPolicy (io.pravega.client.stream.ScalingPolicy)5 ClientFactoryImpl (io.pravega.client.stream.impl.ClientFactoryImpl)5 JavaSerializer (io.pravega.client.stream.impl.JavaSerializer)5