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 — Changing over pub sub from google client libraries to Google cloud java has increased tail latencies · Issue #1338 · googleapis/google-cloud-java

Changing over pub sub from google client libraries to Google cloud java has increased tail latencies #1338

New issue
Copy link
New issue
Copy link
Closed
Closed
Changing over pub sub from google client libraries to Google cloud java has increased tail latencies#1338
Copy link
Assignees
garrettjonesgoogle
Labels
api: pubsubIssues related to the Pub/Sub API.performance

Description

@robin-anil
robin-anil
opened on Oct 26, 2016
Issue body actions

Hi team, I wasn't sure where to file this issue

Here is the chart from our production where we measure roundtrip latencies on messages sent through pub-sub as measured by the same server.

As you can see before the big spike we were on the old Google client libraries the performance was stellar. with p99 close to p50 at around 120ms
The big spike you see is moving over to the Google cloud java version of the pubsub library.
The lower period after that is us moving to directly using the grpc stubs.

The take-away is that GRPC based pub-sub (with return immediately = false) is much worse than what we used to have when we were on the google client library version of pubsub.

Even today in production I can consistenly see roundtrip latencies varying from 120-180s range that spikes to 4-6s every now and then. This was solidly steady in the 120ms range previously.

screen shot 2016-10-26 at 1 12 47 pm

Activity

Next
  1. mziccard commented on Oct 26, 2016

    @mziccard
    mziccard
    on Oct 26, 2016
    Contributor
    More actions

    It's hard to reason on a graph without having actual numbers, your machine/network setup and the code.

    The take-away is that GRPC based pub-sub (with return immediately = false) is much worse

    Since google-cloud-java's pullAsync(String subscription, int maxMessages) and pull(String subscription, int maxMessages) use returnImmediately=true the times you get depend very much on the polling strategy you are implementing. Using MessageConsumer (i.e. pullAsync(String subscription, MessageProcessor callback, PullOption... options)) would surely have better performance (it implements continuous pulling with returnImmediately=false under the hood).

    Good news is that we will soon switch to using returnImmediately=false for all our pullAsync methods. Keep an eye on #1157 for the progress on this.

    Even today in production I can consistenly see roundtrip latencies varying from 120-180s range that spikes to 4-6s every now and then.

    By "today in production" you mean you see those spikes when using gRPC stubs? If this is the case I invite you to report this on the Pub/Sub google group where we can get some insights from the Pub/Sub team.

  2. mziccard
    added
    api: pubsubIssues related to the Pub/Sub API.
    on Oct 26, 2016
  3. robin-anil commented on Oct 26, 2016

    @robin-anil
    robin-anil
    on Oct 26, 2016
    Author
    More actions

    Sorry, these are all 4-cpu 5G Google container engine nodes, VM sizes have been stable the past 6 months and the only thing variable there would be the kubernetes version.

    As for the graph, the deep colors are the 50th percentile, 90, 95 and the lightest one is the p99. The graph is quite skewed as you can see but you can hopefully see the overall trend in the tail latencies by looking how tight the lines were before the switch over on Oct 5 and afterwards when we switched to gRPC

    Thanks. I will report this on the cloud-pubsub group.

  4. mziccard commented on Oct 26, 2016

    @mziccard
    mziccard
    on Oct 26, 2016
    Contributor
    More actions

    @r-tock Just to confirm, which method were you using to pull messages when using google-cloud-java? Care to share some code? (So I can see if there are performance issues when compared to gRPC stubs or its just a matter of setting returnImmediately=false).

  5. robin-anil commented on Oct 26, 2016

    @robin-anil
    robin-anil
    on Oct 26, 2016
    Author
    More actions

    It may be hard to pull the overall code by I can write down the overall architecture.

    I was using pull() we have 4 threads running each of which replicas from the same subscription on a topic. So we assume each will get the values once (if we acknowledge within the timeout). each of the calls pull, processes and acknowledges the message and then pulls again in a loop. The processing and acknowledging happens on a different executor.

    The only difference I think is the returnImmediately=false part (ignoring the tail latencies we are getting with GRPC).

    Here is how we create the channel which goes into creating the pubilsher and subscriber stub. The executor here is useless as it does not seem to be used. ClientAuthInterceptor is marked deprecated without a replacement.

      @Provides
      Channel createChannel(AuthCredentials authCredentials) {
        ManagedChannelImpl managedChannel = NettyChannelBuilder
            .forAddress("pubsub.googleapis.com", 443)
            .negotiationType(NegotiationType.TLS)
            .build();
        GoogleCredentials credentials = authCredentials.credentials().createScoped(SCOPES);
        ClientAuthInterceptor interceptor =
            new ClientAuthInterceptor(credentials, Executors.newSingleThreadExecutor());
        return ClientInterceptors.intercept(managedChannel, interceptor);
      }
  6. mziccard commented on Oct 26, 2016

    @mziccard
    mziccard
    on Oct 26, 2016
    Contributor
    More actions

    each of the calls pull, processes and acknowledges the message and then pulls again in a loop.

    Were you using some sort of timeout/sleep inside the loop?

  7. robin-anil commented on Oct 26, 2016

    @robin-anil
    robin-anil
    on Oct 26, 2016
    Author
    More actions

    Nope, no timeout or sleep which is why we relied heavily on returnImmediately=false

  8. robin-anil commented on Oct 27, 2016

    @robin-anil
    robin-anil
    on Oct 27, 2016
    Author
    More actions

    @mziccard More investigation is on the groups thread
    https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!msg/cloud-pubsub-discuss/jE92Hbc2JbY/LEzfxlfPCAAJ

    You might be interested to know the behavior difference between old pubsub and the new pubsub.

  9. garrettjonesgoogle commented on Nov 21, 2016

    @garrettjonesgoogle
    garrettjonesgoogle
    on Nov 21, 2016
    Contributor
    More actions

    This issue is being worked on internally and may take some time to turn around.

  10. garrettjonesgoogle
    added
    performance
    on Nov 23, 2016
  11. garrettjonesgoogle
    added
    blocking GA
    on Dec 8, 2016
  12. garrettjonesgoogle
    added
    blocking beta
    and removed
    blocking GA
    on Jan 26, 2017
  13. garrettjonesgoogle commented on Jan 26, 2017

    @garrettjonesgoogle
    garrettjonesgoogle
    on Jan 26, 2017
    Contributor
    More actions

    We are working on a high-perf version of Pub/Sub: #1493

  14. garrettjonesgoogle
    assigned
    pongad
    on Jan 26, 2017
  15. 6 remaining items

  16. garrettjonesgoogle
    closed this as completedon Mar 3, 2017
  17. robin-anil commented on Mar 3, 2017

    @robin-anil
    robin-anil
    on Mar 3, 2017
    Author
    More actions

    Yeah, sorry, we just haven't had a chance to think about this. Other things trumping in terms of priority. Will revert back when we are able to catch a breath to think about package upgrades.
    In general the direction you took sounds 👍 will have to test it under real conditions.

  18. theacodes
    unassigned
    pongad
    on Sep 28, 2018
  19. JustinBeckwith
    assigned
    garrettjonesgoogle
    on Feb 1, 2021
  20. meltsufin
    added a commit that references this issue on Dec 22, 2025

    chore(main): release 3.15.1-SNAPSHOT (#1338)

    cc4756b
  21. chingor13
    added a commit that references this issue on Jan 6, 2026

    chore(deps): update dependency com.google.cloud:libraries-bom to v26.…

    f2c34dc
  22. chingor13
    added a commit that references this issue on Jan 22, 2026

    test(deps): update dependency com.google.truth:truth to v1.4.1 (#1338)

    f74eb7d
  23. chingor13
    added a commit that references this issue on Feb 24, 2026

    ci: Update ci.yaml to introduce Java 21 unit testing (#1907) (#1338)

    1e6b1a0
  24. suztomo
    added a commit that references this issue on Mar 11, 2026

    chore(main): release 3.15.1-SNAPSHOT (googleapis#1338)

    edb5a58
  25. chingor13
    added a commit that references this issue on Mar 12, 2026

    ci: Update ci.yaml to introduce Java 21 unit testing (#1907) (#1338)

    2a75dc4
  26. suztomo
    added 2 commits that reference this issue on Mar 23, 2026

    deps: update dependency com.google.cloud:google-cloud-spanner-bom to …

    0d90743

    chore(main): release 2.12.1 (googleapis#1340)

    57394de
  27. suztomo
    added a commit that references this issue on Mar 30, 2026

    chore(deps): update dependency com.google.cloud:google-cloud-nio to v…

    3f626a0
  28. lqiu96
    added a commit that references this issue on Apr 1, 2026

    chore(deps): update dependency com.google.cloud:google-cloud-nio to v…

    ae9fdba
  29. benjaminp
    added a commit that references this issue on Jul 13, 2026

    feat: Support Cloud Bigtable Changestream (googleapis#1569)

    99071f0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @garrettjonesgoogle
    garrettjonesgoogle

Labels

api: pubsubIssues related to the Pub/Sub API.performance

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.