GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — 2.x: resilience in the parallel() operators · Issue #5128 · ReactiveX/RxJava

2.x: resilience in the parallel() operators #5128

New issue
Copy link
New issue
Copy link
Closed
Closed
2.x: resilience in the parallel() operators#5128
Copy link
Labels
2.xDiscussion

Description

@akarnokd
akarnokd
opened on Feb 22, 2017
Issue body actions

When the architecture of the parallel() subsystem was designed, the goal was to provide means for efficient parallel computations over recovering from failures in any or most of the parallel 'rails' in it. This resulted fail-fast implementation and little to no means (beyond flatMap) to prevent the death of the whole parallel computation due to a single failing component.

Adding the usual onErrorResumeNext or retry doesn't work because the core driver, parallel() can't support resubscription on its individual rails and even if, a failure behind a runOn almost certainly would drop any unprocessed elements in its queue.

The given toolset, ParallelFlowable already gives the opportunity to include resilience at the cost of overhead: flatMap and/or concatMap. As with the traditional flows, the inner Flowables to these can have all sorts of operators not available on parallel() itself and are confined to the particular 'rail', thus retry()/onErrorResumeNext can be applied on a per item basis:

Flowable.range(1, 100)
.parallel(20)
.runOn(Schedulers.io())
.concatMap(index -> api.getImage(index).onErrorResumeNext(Flowable.just(notAvailableImage)))
.sequential()
.observeOn(guiThread)
.subscribe(...)

On the other hand, parallel-map/doOnNext (among others) don't offer any ignore/resume option out of box and unless the developer applies try-catch to prevent crashing the 'rail'.

To enable finer gained control in this situation, I propose the following overloads:

  • enum FailureHandling: stop, error, skip, retry
  • map(Function<T, R>, FailureHandling)
  • map(Function<T, R>, Function<Throwable, FailureHandling>)
  • filter(Predicate<T>, FailureHandling)
  • filter(Predicate<T>, Function<Throwable, FailureHandling>)
  • doOnNext(Action<T>, FailureHandling)
  • doOnNext(Action<T>, Function<Throwable, FailureHandling>)

They should cover the the cases where the Function hosts a blocking call (if there was a need for timed backoff, the concatMap approach is still available).

Thoughts?

Activity

  1. akarnokd
    added
    2.x
    Discussion
    on Feb 22, 2017
  2. akarnokd commented on Mar 27, 2017

    @akarnokd
    akarnokd
    on Mar 27, 2017
    MemberAuthor
    More actions

    Closing via #5202.

  3. akarnokd
    closed this as completedon Mar 27, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    2.xDiscussion

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.