graphql-engine icon indicating copy to clipboard operation
graphql-engine copied to clipboard

support parallel execution of action queries

Open maitham opened this issue 4 years ago • 9 comments

Hey,

We've assumed multiple queries in the same graphql statement would happen in parallel as per the docs. We get this behaviour with normal queries, however if the queries contain an action it seems these happen sequentially not in parallel. Is this expected behaviour?

maitham avatar Jun 08 '20 21:06 maitham

We've assumed multiple queries in the same graphql statement would happen in parallel as per the docs.

Can you point us to the docs?

tirumaraiselvan avatar Jun 16 '20 06:06 tirumaraiselvan

https://hasura.io/docs/1.0/graphql/manual/queries/multiple-queries.html

If multiple queries are part of the same request, they are executed in parallel, the individual responses are collated and returned. You can fetch objects of different unrelated types in the same query.

Is this only valid for pure graphql queries rather than ones that rely on actions?

maitham avatar Jun 16 '20 10:06 maitham

This was actually a mistake in the documentation and is being fixed here: https://github.com/hasura/graphql-engine/pull/5105

Normal queries and actions, both are run sequentially.

tirumaraiselvan avatar Jun 16 '20 12:06 tirumaraiselvan

Ah thats a shame. Are there any plans to support parallel queries? It seems to be a given that this should be the behaviour at least for actions

maitham avatar Jun 16 '20 17:06 maitham

Yes, I think we should be able to do that in the future. Will change this issue into a feature request.

tirumaraiselvan avatar Jun 16 '20 17:06 tirumaraiselvan

Not 100% the same feature request, but very much in the same vein: I want to run an action at the end of a CRUD operation that depends on the results of the prior operation.

It needs to be synchronous, so can't run after. The alternatives are

  • Bring the CRUD logic into an action -- It seems like overkill to have to create 4 actions with a bunch of boilerplate webhook code
  • Chain the requests client-side

It would be great to somehow tell Hasura to close the DB transaction before triggering the action.

rccoe avatar Aug 25 '20 23:08 rccoe

Adding to this, for queries containing multiple parts, it would be a huge performance improvement (at least for some/our use case) if these could be run in parallel, rather than sequentially. In this case there should be no interdependence on each, so theres no reason I can think of for these not to run in parallel?

craighawkes avatar Oct 15 '21 02:10 craighawkes

Any update on this request?

harpyng avatar Dec 29 '21 23:12 harpyng

Hi, I want to update that we are launching Hasura V3 (DDN) this month, and it would be worth noting that parallel and batch execution is something that has been built in a great way in V3 (both queries and actions). The query tracing feature also provides a good view of this parallelisation. In V3, actions are now supported as custom Typescript code driven modules that allows for a lot of customisation around business logic and runtime parallelisation (using NodeJS executor).

On that note, we're celebrating our DDN beta launch at Hasura Dev Day on April 16 :tada: Join us to see the full power of Hasura DDN. Sign up here: https://hasura.io/dev-day. Can't make it? Sign up anyway and we'll send you the recording.

manasag avatar Apr 11 '24 14:04 manasag