Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Oct 20 17:41

    mergify[bot] on master

    Update scalafmt-core to 3.0.7 Merge pull request #633 from sc… (compare)

  • Oct 20 17:41
    mergify[bot] closed #633
  • Oct 20 17:35
    scala-steward opened #633
  • Oct 20 15:07

    mergify[bot] on master

    Update mdoc, sbt-mdoc to 2.2.24 Merge pull request #632 from sc… (compare)

  • Oct 20 15:07
    mergify[bot] closed #632
  • Oct 20 15:01
    scala-steward opened #632
  • Oct 18 17:41

    mergify[bot] on master

    Update scala-library to 2.12.15 Merge branch 'master' into upda… Update scala-library to 2.12.15 and 1 more (compare)

  • Oct 18 17:41
    mergify[bot] closed #615
  • Oct 18 17:36
    scala-steward synchronize #615
  • Oct 18 12:58

    mergify[bot] on master

    Update scala3-library to 3.1.0 Merge pull request #631 from sc… (compare)

  • Oct 18 12:58
    mergify[bot] closed #631
  • Oct 18 12:53
    scala-steward opened #631
  • Oct 18 00:48

    mergify[bot] on master

    Update fs2-core to 3.1.6 Merge pull request #630 from sc… (compare)

  • Oct 18 00:48
    mergify[bot] closed #630
  • Oct 18 00:41
    scala-steward opened #630
  • Oct 14 14:58

    mergify[bot] on master

    Update sbt-ci-release to 1.5.10 Merge pull request #629 from sc… (compare)

  • Oct 14 14:58
    mergify[bot] closed #629
  • Oct 14 14:52
    scala-steward opened #629
  • Oct 08 05:13

    mergify[bot] on master

    Update fs2-core to 3.1.5 Merge pull request #628 from sc… (compare)

  • Oct 08 05:13
    mergify[bot] closed #628
Gabriel Volpe
@gvolpe
v3.0.1 is on its way to Maven Central: https://github.com/profunktor/fs2-rabbit/runs/1270696103
Artem Nikiforov
@nikiforo
Hi all,
Is there any library-like solution to cache connections, channels when publishing for fs2-rabbit?
Gabriel Volpe
@gvolpe
@nikiforo a connection is given as a cats.effect.Resource, there's no need to cache that. The connection will be valid in the use { ... } block.
Unless you have a different use case that I don't understand
Artem Nikiforov
@nikiforo

While googling, I encountered several recommendations, that it's better to share connections, because they are expensive to create.

For example this article mentions, that 13 Tcp packets are used to establish a connection+channel
https://www.cloudamqp.com/blog/2018-01-19-part4-rabbitmq-13-common-errors.html

Artem Nikiforov
@nikiforo
I've also found mentions, that Java Spring has some rabbit ConnectionFactory, but haven't explored that further.
Gabriel Volpe
@gvolpe
That's correct, and it's the same with any other messaging broker, database, etc
cats.effect.Resource gives you fine-grained control over your resource, in this case, the RabbitMQ connection
Share your connection within that use { ... } block, which delimits the resource lifetime
This concept is normally called "shared state". You can give this a read if you're not familiar with it: https://typelevel.org/blog/2018/06/07/shared-state-in-fp.html
There's also a talk by Fabio Labella which expands a bit more on the topic: http://systemfw.org/talks (the one at Scala Italy 2018)
Artem Nikiforov
@nikiforo

Indeed, within .use { ... } and Stream.resource this resource will be used, but if an error occures, I should reopen a connection and use the reopened connection in subsequent actions(just like ResilientStream in resilency package).

And I thought that logic of acquiring the connection should be encapsulated somewhere in ConnectionProvider.

Thanks! I'll watch the video and read the article thoroughly!

Gabriel Volpe
@gvolpe

if an error occures, I should reopen a connection

It's the users' responsibility to handle errors. If you don't want the connection to terminate on errors, have look at handleErrorWith, recoverWith, etc

You can find more about shared-state and other design patterns in this book as well: https://leanpub.com/pfp-scala (included in the first two chapters that can be downloaded for free)
Gavin Bisesi
@Daenyth
AFAIK the fs2-rabbit resource impl uses the built-in auto-recovering channel
so you shouldn't need to do anything
Artem Nikiforov
@nikiforo
Wow, it is documented, that some kind of recovery occures on network errors.
https://www.rabbitmq.com/api-guide.html#recovery
BTW, It seems that a ConnectionFactory is created every time createConnection is evoked
Artem Nikiforov
@nikiforo
I should definetely check that, but I think this isn't the way how createConnection should behave, or should it create ConnectionFactory every on every createConnection?
Gavin Bisesi
@Daenyth
Generally you only createConnection once or few times, though
I think I traced it through and CF doesn't have state
I forget
Artem Nikiforov
@nikiforo
Gavin Bisesi
@Daenyth
@gvolpe Looks like we have some bites on the 'new maintainers' thread. Want to add them?
Gabriel Volpe
@gvolpe
@Daenyth done. I also gave you admin permissions, you should be able to add more maintainers in the future, I guess
Gavin Bisesi
@Daenyth
:+1: thanks
Adam Nadoba
@anadoba

Hello guys. I have just integrated fs2-rabbit into my app and there is some kind of weird behavior about it.
Basically, the consumer app I created behaves like that:

  • if I start the app (consumer), when RabbitMQ queue is empty, and then I start producing events, the performance is quite good, 5000msg/s with CPU usage 20-25%
  • if I start the app, when RabbitMQ queue is already populated (a few thousand events in the queue), then the consumer app performance is like 200msg/s (20 times worse) with CPU usage 98-100%

My RabbitMQ knowledge is very little, that's why I do not know where I should look for a problem. Is it some kind of a common issue? Should I investigate the library code and try to tune the client settings? Or maybe I should just connect to my app with VisualVM because my code does some strange stuff (the app is rather simple though)

any advice would be appreciated :)
Gavin Bisesi
@Daenyth
I don't know how to help with that, but I will say I don't recall ever seeing a difference in performance like that
Adam Nadoba
@anadoba
well, VisualVM it is then :) thanks for the answer
jbwheatley
@jbwheatley
Hi all,
the series/4.x branch has now been updated to use cats-effect 3.0.0 and fs2 3.0.0! I have a couple of outstanding PRs of features that could be included in a 4.0.0 release - profunktor/fs2-rabbit#502 and profunktor/fs2-rabbit#503. Would be good to get some eyes on these. Otherwise I will probably press-on and release 4.0.0 in the coming days :)