Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (Cyborg)
  • No Skin
Collapse
Brand Logo

CIRCLE WITH A DOT

  1. Home
  2. Uncategorized
  3. I've started my exploration of using @timbray's Quamina project for saving some compute time in the filters module of #GoActivityPub

I've started my exploration of using @timbray's Quamina project for saving some compute time in the filters module of #GoActivityPub

Scheduled Pinned Locked Moved Uncategorized
activitypubgoactivitypub
13 Posts 3 Posters 0 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • mariusor@metalhead.clubM mariusor@metalhead.club

    Sadly adding quamina didn't bring any meaningful changes to the integration test suite I'm using for my federated server, probably because the amount of data they handle is way too low and the overhead of running the application and testsuite is way too high.

    It looks like I need to build some artificial benchmarks handling strictly the storage fetches.

    #benchmarking

    mariusor@metalhead.clubM This user is from outside of this forum
    mariusor@metalhead.clubM This user is from outside of this forum
    mariusor@metalhead.club
    wrote on last edited by
    #3

    Well, benchmarking doesn't help either, the measurements are so noisy that I can't even make any inferences from them.

    I'm not sure how I can isolate the tests even more.

    Perhaps the issue is that all the tests rely on the actual filesystem.

    Maybe I need to find a memory backed filesystem mock...

    mariusor@metalhead.clubM 1 Reply Last reply
    2
    0
    • R relay@relay.mycrowd.ca shared this topic on
    • mariusor@metalhead.clubM mariusor@metalhead.club

      Well, benchmarking doesn't help either, the measurements are so noisy that I can't even make any inferences from them.

      I'm not sure how I can isolate the tests even more.

      Perhaps the issue is that all the tests rely on the actual filesystem.

      Maybe I need to find a memory backed filesystem mock...

      mariusor@metalhead.clubM This user is from outside of this forum
      mariusor@metalhead.clubM This user is from outside of this forum
      mariusor@metalhead.club
      wrote on last edited by
      #4

      I realized I already run on a memory backed filesystem, as the default testing.T.TempDir() returns a path in /tmp which is tmpfs for the machine where I'm testing.

      Gaaah!!!

      1 Reply Last reply
      1
      0
      • mariusor@metalhead.clubM mariusor@metalhead.club

        I've started my exploration of using @timbray's Quamina project for saving some compute time in the filters module of #GoActivityPub

        Currently the GoAP storage backends iterate over resources (usually stored as raw JSON bytes), unmarshal them into GoActivityPub object structs, and *only* then apply the custom filtering logic on those objects. Since the majority of the objects generally fail the filtering logic, all that JSON decoding is wasted compute time and makes things slower.

        Ideally quamina will allow me to check the raw JSON payloads directly against the filters, streamlining the execution and speeding things up.

        #ActivityPub

        mariusor@metalhead.clubM This user is from outside of this forum
        mariusor@metalhead.clubM This user is from outside of this forum
        mariusor@metalhead.club
        wrote last edited by
        #5

        I have finally I made significant progress on this.

        The final code looks like this:

        Link Preview Image
        filters/bytes_filter.go at master · go-ap/filters

        A package to help with filtering ActivityPub objects in the various storage components - filters/bytes_filter.go at master · go-ap/filters

        favicon

        GitHub (github.com)

        For a list of filters that #GoActivityPub uses, we generate two patterns for Quamina: one for a denormalized raw document, and one for normalized raw document (they usually are stored in a normalized form, where an Activity's object/actor properties are flattened to their IRIs, but we can't know which it is unless we unmarshall it, which we want to avoid)

        Another improvement from my complain from 4 days ago is that I was regenerating the patterns and initializing quamina for every new document, instead of one time per collection load.

        timbray@cosocial.caT 1 Reply Last reply
        1
        0
        • mariusor@metalhead.clubM mariusor@metalhead.club

          I have finally I made significant progress on this.

          The final code looks like this:

          Link Preview Image
          filters/bytes_filter.go at master · go-ap/filters

          A package to help with filtering ActivityPub objects in the various storage components - filters/bytes_filter.go at master · go-ap/filters

          favicon

          GitHub (github.com)

          For a list of filters that #GoActivityPub uses, we generate two patterns for Quamina: one for a denormalized raw document, and one for normalized raw document (they usually are stored in a normalized form, where an Activity's object/actor properties are flattened to their IRIs, but we can't know which it is unless we unmarshall it, which we want to avoid)

          Another improvement from my complain from 4 days ago is that I was regenerating the patterns and initializing quamina for every new document, instead of one time per collection load.

          timbray@cosocial.caT This user is from outside of this forum
          timbray@cosocial.caT This user is from outside of this forum
          timbray@cosocial.ca
          wrote last edited by
          #6

          @mariusor BTW I think Spencer Nelson just fixed Quamina's /v2 problem. Now I'll look at what you did (somehow I missed this post back in February)

          mariusor@metalhead.clubM 1 Reply Last reply
          0
          • timbray@cosocial.caT timbray@cosocial.ca

            @mariusor BTW I think Spencer Nelson just fixed Quamina's /v2 problem. Now I'll look at what you did (somehow I missed this post back in February)

            mariusor@metalhead.clubM This user is from outside of this forum
            mariusor@metalhead.clubM This user is from outside of this forum
            mariusor@metalhead.club
            wrote last edited by
            #7

            @timbray no worries, there isn't much that I did on my side.

            I have some "filter" types, that I use for filtering ActivityPub collections and objects and now they get transformed into quamina patterns and applied on the raw json that we store the ActivityPub objects as before marshaling them into the structs that the filters themselves get applied against.

            Hopefully it saves some computation, but the benchmarks I created weren't very conclusive... perhaps because there's so much other functionality in the pipeline...

            However the feature has made its way into production into the various servers that use this library...

            mariusor@metalhead.clubM 1 Reply Last reply
            0
            • mariusor@metalhead.clubM mariusor@metalhead.club

              @timbray no worries, there isn't much that I did on my side.

              I have some "filter" types, that I use for filtering ActivityPub collections and objects and now they get transformed into quamina patterns and applied on the raw json that we store the ActivityPub objects as before marshaling them into the structs that the filters themselves get applied against.

              Hopefully it saves some computation, but the benchmarks I created weren't very conclusive... perhaps because there's so much other functionality in the pipeline...

              However the feature has made its way into production into the various servers that use this library...

              mariusor@metalhead.clubM This user is from outside of this forum
              mariusor@metalhead.clubM This user is from outside of this forum
              mariusor@metalhead.club
              wrote last edited by
              #8

              @timbray erm... apologies for the verbosity, on a second look my first paragraph doesn't read very well at all. Hopefully it makes at least a little sense.

              Anyway the permalink to the function where I do all that has changed a little since previous post: https://github.com/go-ap/filters/blob/master/bytes_filter.go#L201

              timbray@cosocial.caT 1 Reply Last reply
              0
              • mariusor@metalhead.clubM mariusor@metalhead.club

                @timbray erm... apologies for the verbosity, on a second look my first paragraph doesn't read very well at all. Hopefully it makes at least a little sense.

                Anyway the permalink to the function where I do all that has changed a little since previous post: https://github.com/go-ap/filters/blob/master/bytes_filter.go#L201

                timbray@cosocial.caT This user is from outside of this forum
                timbray@cosocial.caT This user is from outside of this forum
                timbray@cosocial.ca
                wrote last edited by
                #9

                @mariusor OK, feel free to yell at me if anything goes wrong.

                mariusor@metalhead.clubM 1 Reply Last reply
                1
                0
                • R relay@relay.mycrowd.ca shared this topic
                • timbray@cosocial.caT timbray@cosocial.ca

                  @mariusor OK, feel free to yell at me if anything goes wrong.

                  mariusor@metalhead.clubM This user is from outside of this forum
                  mariusor@metalhead.clubM This user is from outside of this forum
                  mariusor@metalhead.club
                  wrote last edited by
                  #10

                  @timbray so far there isn't a v2 in the go proxy ecosystem. I don't know if it's because there's lag before the version gets picked up and disseminated or there's still something missing. I'll keep an eye on it and let you know tomorrow if it's still not there.

                  Link Preview Image
                  quamina package versions - quamina.net/go/quamina - Go Packages

                  favicon

                  (pkg.go.dev)

                  timbray@cosocial.caT 1 Reply Last reply
                  0
                  • mariusor@metalhead.clubM mariusor@metalhead.club

                    @timbray so far there isn't a v2 in the go proxy ecosystem. I don't know if it's because there's lag before the version gets picked up and disseminated or there's still something missing. I'll keep an eye on it and let you know tomorrow if it's still not there.

                    Link Preview Image
                    quamina package versions - quamina.net/go/quamina - Go Packages

                    favicon

                    (pkg.go.dev)

                    timbray@cosocial.caT This user is from outside of this forum
                    timbray@cosocial.caT This user is from outside of this forum
                    timbray@cosocial.ca
                    wrote last edited by
                    #11

                    @mariusor Please do let me know, I thought we had that sorted

                    swnelson@mastodon.socialS 1 Reply Last reply
                    1
                    0
                    • timbray@cosocial.caT timbray@cosocial.ca

                      @mariusor Please do let me know, I thought we had that sorted

                      swnelson@mastodon.socialS This user is from outside of this forum
                      swnelson@mastodon.socialS This user is from outside of this forum
                      swnelson@mastodon.social
                      wrote last edited by
                      #12

                      @timbray @mariusor I think this is up and running at https://pkg.go.dev/quamina.net/go/quamina/v2.

                      You won't see it on the https://pkg.go.dev/quamina.net/go/quamina?tab=versions because a new major version constitutes a new module path. https://pkg.go.dev/quamina.net/go/quamina has a tiny callout at the top of the page that says "The highest tagged major version is v2."

                      mariusor@metalhead.clubM 1 Reply Last reply
                      0
                      • swnelson@mastodon.socialS swnelson@mastodon.social

                        @timbray @mariusor I think this is up and running at https://pkg.go.dev/quamina.net/go/quamina/v2.

                        You won't see it on the https://pkg.go.dev/quamina.net/go/quamina?tab=versions because a new major version constitutes a new module path. https://pkg.go.dev/quamina.net/go/quamina has a tiny callout at the top of the page that says "The highest tagged major version is v2."

                        mariusor@metalhead.clubM This user is from outside of this forum
                        mariusor@metalhead.clubM This user is from outside of this forum
                        mariusor@metalhead.club
                        wrote last edited by
                        #13

                        @swnelson nice, I did try the /v2 also, but it wasn't up when I commented, thank you.

                        @timbray

                        1 Reply Last reply
                        1
                        0
                        Reply
                        • Reply as topic
                        Log in to reply
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes


                        • Login

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • World
                        • Users
                        • Groups