Giter Site home page Giter Site logo

pragmaticminds / crunch Goto Github PK

View Code? Open in Web Editor NEW
13.0 8.0 3.0 3.13 MB

Industrial data evaluation engine

Home Page: https://pragmaticminds.de/

License: Apache License 2.0

Java 100.00%
time-series java iiot iot industrial-automation industry-4

crunch's Issues

Documentation

While the readme talks about the the differences in the goal of this project from other streaming data processing frameworks, there is no documentation about the design, the philosophy, or the implementation of crunch.

Major Performance Improvement

From my analysis (see #10) it looks like the main reason for our massive perofrmance degradation is that we use HashMap<String, Object> for the transport of values. But we have too many operations for each record which adds up and leads to several Millions of operations for a mediocre sized batch of messages (140k messages lead to 80 Mio hash calculations on String).

So I suggest to rewrite the value handling internally (not externally) and this should lead to a massive performance gain (I expect x10 - x100 speedup).
There are different ideas I have and I'll try to document it.

But I wanted to open an Issue here to track work on this topic.

Performance Issues for streams with many messages

Currently, we observe a performance problem when processing many messages in a Stream with man evaluation functions or with evaluation functions that "look" at many signals.
I already did some analysis in the branch "performance-test".

The class TestCrunchPerformanceNT contains the main to run the tests (and also a setup to run it with JMH with the IntelliJ Plugin).

The file referenced there is 30MB large and thus not in the repo but is shared in the crunch-oss channel in Slack (or downloaded here: https://pragmaticminds.slack.com/files/U1Q8RMFDL/FFEAR60TS/sample2.txt)

NullPointerException in org.pragmaticminds.crunch.api.trigger.extractor.ChannelMapExtractor.extract(ChannelMapExtractor.java:105)

This Exception occures when an ChannelMapExtractor tries to extract channels, that are not present.

Exception printout:

10:48:45.700 [main] WARN org.pragmaticminds.crunch.execution.CrunchExecutor - Unable to wait for execution of pipeline.
java.util.concurrent.ExecutionException: java.lang.NullPointerException
at java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:357) ~[?:1.8.0_201]
at java.util.concurrent.CompletableFuture.get(CompletableFuture.java:1895) ~[?:1.8.0_201]
at scala.concurrent.java8.FuturesConvertersImpl$CF.super$get(FutureConvertersImpl.scala:82) ~[scala-java8-compat_2.12-0.8.0.jar:?]
at scala.concurrent.java8.FuturesConvertersImpl$CF.$anonfun$get$1(FutureConvertersImpl.scala:82) ~[scala-java8-compat_2.12-0.8.0.jar:?]
at scala.concurrent.BlockContext$DefaultBlockContext$.blockOn(BlockContext.scala:53) ~[scala-library-2.12.6.jar:?]
at scala.concurrent.package$.blocking(package.scala:142) ~[scala-library-2.12.6.jar:?]
at scala.concurrent.java8.FuturesConvertersImpl$CF.get(FutureConvertersImpl.scala:82) ~[scala-java8-compat_2.12-0.8.0.jar:?]
at org.pragmaticminds.crunch.execution.CrunchExecutor.runWithSink(CrunchExecutor.java:101) [crunch-core-0.3.0.jar:0.3.0]
at org.pragmaticminds.crunch.execution.CrunchExecutor.run(CrunchExecutor.java:75) [crunch-core-0.3.0.jar:0.3.0]
at org.pragmaticindustries.inacore.standalone.Application.main(Application.java:29) [classes/:?]
Caused by: java.lang.NullPointerException
at java.util.HashMap.merge(HashMap.java:1225) ~[?:1.8.0_201]
at java.util.stream.Collectors.lambda$toMap$58(Collectors.java:1320) ~[?:1.8.0_201]
at java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169) ~[?:1.8.0_201]
at java.util.HashMap$EntrySpliterator.forEachRemaining(HashMap.java:1699) ~[?:1.8.0_201]
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481) ~[?:1.8.0_201]
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) ~[?:1.8.0_201]
at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708) ~[?:1.8.0_201]
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:1.8.0_201]
at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499) ~[?:1.8.0_201]
at org.pragmaticminds.crunch.api.trigger.extractor.ChannelMapExtractor.extract(ChannelMapExtractor.java:105) ~[crunch-api-0.3.0.jar:0.3.0]
at org.pragmaticminds.crunch.api.trigger.handler.ExtractorTriggerHandler.lambda$handle$0(ExtractorTriggerHandler.java:99) ~[crunch-api-0.3.0.jar:0.3.0]
at java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:267) ~[?:1.8.0_201]
at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1382) ~[?:1.8.0_201]
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481) ~[?:1.8.0_201]
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471) ~[?:1.8.0_201]
at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708) ~[?:1.8.0_201]
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) ~[?:1.8.0_201]
at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499) ~[?:1.8.0_201]
at org.pragmaticminds.crunch.api.trigger.handler.ExtractorTriggerHandler.handle(ExtractorTriggerHandler.java:104) ~[crunch-api-0.3.0.jar:0.3.0]
at org.pragmaticminds.crunch.api.trigger.TriggerEvaluationFunction.eval(TriggerEvaluationFunction.java:152) ~[crunch-api-0.3.0.jar:0.3.0]
at org.pragmaticminds.crunch.execution.GraphFactory.lambda$toFlow$50b6d5dc$1(GraphFactory.java:209) ~[crunch-core-0.3.0.jar:0.3.0]
at akka.stream.javadsl.Flow.$anonfun$map$1(Flow.scala:484) ~[akka-stream_2.12-2.5.16.jar:2.5.16]
at akka.stream.impl.fusing.Map$$anon$9.onPush(Ops.scala:51) ~[akka-stream_2.12-2.5.16.jar:2.5.16]
at akka.stream.impl.fusing.GraphInterpreter.processPush(GraphInterpreter.scala:519) ~[akka-stream_2.12-2.5.16.jar:2.5.16]
at akka.stream.impl.fusing.GraphInterpreter.execute(GraphInterpreter.scala:411) ~[akka-stream_2.12-2.5.16.jar:2.5.16]
at akka.stream.impl.fusing.GraphInterpreterShell.runBatch(ActorGraphInterpreter.scala:588) ~[akka-stream_2.12-2.5.16.jar:2.5.16]
at akka.stream.impl.fusing.GraphInterpreterShell$AsyncInput.execute(ActorGraphInterpreter.scala:472) ~[akka-stream_2.12-2.5.16.jar:2.5.16]
at akka.stream.impl.fusing.GraphInterpreterShell.processEvent(ActorGraphInterpreter.scala:563) ~[akka-stream_2.12-2.5.16.jar:2.5.16]
at akka.stream.impl.fusing.ActorGraphInterpreter.akka$stream$impl$fusing$ActorGraphInterpreter$$processEvent(ActorGraphInterpreter.scala:745) ~[akka-stream_2.12-2.5.16.jar:2.5.16]
at akka.stream.impl.fusing.ActorGraphInterpreter$$anonfun$receive$1.applyOrElse(ActorGraphInterpreter.scala:760) ~[akka-stream_2.12-2.5.16.jar:2.5.16]
at akka.actor.Actor.aroundReceive(Actor.scala:517) ~[akka-actor_2.12-2.5.16.jar:2.5.16]
at akka.actor.Actor.aroundReceive$(Actor.scala:515) ~[akka-actor_2.12-2.5.16.jar:2.5.16]
at akka.stream.impl.fusing.ActorGraphInterpreter.aroundReceive(ActorGraphInterpreter.scala:670) ~[akka-stream_2.12-2.5.16.jar:2.5.16]
at akka.actor.ActorCell.receiveMessage(ActorCell.scala:588) ~[akka-actor_2.12-2.5.16.jar:2.5.16]
at akka.actor.ActorCell.invoke(ActorCell.scala:557) ~[akka-actor_2.12-2.5.16.jar:2.5.16]
at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:258) ~[akka-actor_2.12-2.5.16.jar:2.5.16]
at akka.dispatch.Mailbox.run(Mailbox.scala:225) ~[akka-actor_2.12-2.5.16.jar:2.5.16]
at akka.dispatch.Mailbox.exec(Mailbox.scala:235) ~[akka-actor_2.12-2.5.16.jar:2.5.16]
at akka.dispatch.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260) ~[akka-actor_2.12-2.5.16.jar:2.5.16]
at akka.dispatch.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339) ~[akka-actor_2.12-2.5.16.jar:2.5.16]
at akka.dispatch.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979) ~[akka-actor_2.12-2.5.16.jar:2.5.16]
at akka.dispatch.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107) ~[akka-actor_2.12-2.5.16.jar:2.5.16]
10:48:48.155 [Thread-100] INFO org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext - Closing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@550dbc7a: startup date [Thu Jan 24 10:47:10 CET 2019]; root of context hierarchy

Fix vulnerabilites

Several vulnerabilies are present (akka!!) and others reported by dependency plugin.
This has to be fixed and tested.

Reported by @chrisdutz

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.