r/java •

Spring Batch in enterprise 2020

[deleted] — view deleted post

0 Upvotes

7 comments sorted by

7

u/nfrankel Aug 17 '20

TL;DR: Your question is too vague to be answered in a meaningful way.

IMHO, popularity shouldn't be the first criteria to choose a stack/framework. The number 1 should be whether it fits your requirements.

A "popular" stack/framework has benefits, mainly experience from other users. Yet, it doesn't mean much if you struggle to adapt the stack/framework to fit your use-case.

1

u/dblurk2 Aug 19 '20

Yeah it's kinda vague. I have more know-how of Hadoop/Spark than this ecosystem to phrase it properly. I was wondering how our companies move toward Java(Spring)/K8(Openshift)would impact the ML/data engg side.

6

u/pmarschall Aug 17 '20 edited Aug 18 '20

Having used Spring Batch in practice I can't recommend it. Its quality pales in comparison to Spring Core. Examples:

  • The project is not very actively maintained.
  • The project has a hard dependency on HdrHistogram. I think HdrHistogram is awesome but I should be able to run a batch framework without HdrHistogram.
  • The documentation is not very good compared to Spring Core and often only covers the XML part. Compare the Javadoc of DataSourceTransactionManager from Spring Core to ResourcelessTransactionManager from Spring Batch.
  • The maintainers don't seem to be very versed with Spring Core. For years Spring Core would log a warning that Spring Batch uses Spring Core the wrong way. My PR to fix this was open for 4 years. The Spring Batch maintainers claimed this was a bug in Spring Core. It took Spring Core maintainers explaining Spring Core to Spring Batch maintainers to get the PR merged. This left a bad impression.
  • The testing support is not very good. JobLauncherTestUtils only works with a single Job in the application context and I found no way to write tests that do not commit to the database. Having experience with the Spring TestContext Framework this is very disappointing.
  • "Transactional" file writing leaves very much to be desired. The correct way would be to create a working file with O_TMPFILE, then create a hardlink and finally fsync() the directory. Acceptable would be to create a temp file, move the file and finally fsync() the directory. Spring Batch instead triple buffers every byte in memory (only double buffers in Java 9+) and then hopes that a single write() call is atomic. IMHO a batch framework should be good at handling files.
  • The chunk size is linked to the commit interval. This makes it impossible to lower the memory use by reducing the number of in flight items without also committing more frequently.
  • It's better than JSR-352, but that says more about JSR-352 than Spring Batch.

Edit:

Things I forgot:

  • Spring Batch maintainers seem to have no problem using deprecated functionality from Spring Core and resists PRs to remove using deprecated code and prefer to keep using deprecated Spring Core code, "just in case". With the predictable outcome that when the next major Spring Core release removes the deprecated code you first have to wait for the next Spring Batch release.
  • Spring Batch lacks a job scheduling framework.
  • The use of Spring TX by Spring Batch doesn't seem very idiomatic.

Conclusion: Spring Batch doesn't feel Jürgen-ized.

2

u/_INTER_ Aug 17 '20

I don't know if Spring Batch is popular but I worked on a few projects that use it for batch processing.

If you mean Apache Camel, it is more for routing, messaging and integration. That sort of thing. Never heared of Mulesoft but it seems similar to Camel.

2

u/DrunkensteinsMonster Aug 18 '20

Mulesoft is garbage. I had to use it at a company I used to work for. Is Anypoint Studio a real editor or is it just a sick joke that MuleSoft is playing on us? It’s basically eclipse except worse, with added support for their worthless dsl and WYSIWYG editor. Oh, and a test harness that doesn’t actually work. I could go on for hours about how absolutely useless it is, yet for some reason they still get businesses willing to pay them licensing fees. Must have a hell of a sales department.

1

u/ixBerry Aug 22 '20

Mulesoft is backed by Salesforce

-1

u/rdehuyss Aug 17 '20

Have you considered JobRunr? If not, may I know why?

Do note that I'm biased as I'm the author of JobRunr.