Fork me on GitHub
#hyperfiddle
<
2024-01-24
>
joshcho01:01:43

has anyone experimented with electric and crdt’s?

henrik08:01:50

The RT editor above uses a CRDT (Automerge). AMA.

joshcho08:01:36

i noticed in the demo that the changes weren’t character-by-character, is that dependent on how you set it up?

joshcho08:01:42

merging, etc.

henrik08:01:08

The reason it isn’t character by character is because I roundtrip to Rama between. Automerge can be used peer-to-peer as well, or just against an in-memory document that you keep server-side. However, I 1) didn’t want to send out changes that to peers unless I know they have been durably recorded, and 2) If you go for the in-memory document approach, you get scalability problems. Rama takes care of scalability. So for my approach, I went for a microbatch topology, meaning that Rama will collect 200-400ms worth of changes coming in, aggregate and save them, and only then will those changes be pushed to peers. You could set it up for quick turnaround times, but I went for scalability and consistency instead.

❤️ 1
joshcho08:01:43

woah thanks for the detailed response! this is awesome :saluting_face:

👍 1
wei07:01:16

has anyone seen shadow OOM errors like this? seems to happen to me every few compilations. I've tried giving the shadow more memory (`-Xmx5G`) to no avail. I do have a 500+ line cljc file, but I've seen shadow work with larger files. I'm on the IC branch. wondering how to further troubleshoot this.

[2024-01-23 23:41:50.852 - WARNING] :shadow.cljs.devtools.server.util/handle-ex - {:msg {:namespaces #{app.scopes4}, :deleted #{}, :updated #{app.scopes4}, :added #{}, :macros #{}, :shadow.cljs.model/topic :shadow.cljs.model/resource-update}}
OutOfMemoryError Java heap space
	java.util.Arrays.copyOf (Arrays.java:3537)
	java.lang.AbstractStringBuilder.ensureCapacityInternal (AbstractStringBuilder.java:228)
	java.lang.AbstractStringBuilder.append (AbstractStringBuilder.java:582)
	java.lang.StringBuilder.append (StringBuilder.java:179)
	clojure.string/join (string.clj:191)
	clojure.string/join (string.clj:180)
	shadow.build.targets.browser/flush-unoptimized-module-eval (browser.clj:522)
	shadow.build.targets.browser/flush-unoptimized-module-eval (browser.clj:506)
	shadow.build.targets.browser/flush-unoptimized-module (browser.clj:661)
	shadow.build.targets.browser/flush-unoptimized-module (browser.clj:656)
	shadow.build.targets.browser/flush-unoptimized/fn--56013/fn--56015 (browser.clj:683)
	clojure.lang.PersistentVector.reduce (PersistentVector.java:343)

👀 1
wei08:01:55

update: found the culprit but not sure what's wrong with it. the OOM goes away when I comment this out. https://gist.github.com/yayitswei/364f7106d606de27d57fb27c63cc80f2

Geoffrey Gaillard10:01:23

Not clear what’s happening. But I have an intuition. Could you please try adding :loader-mode :default under shadow-cljs.edn -> :builds -> :your-build-id -> :devtools. Like this:

{:builds
 {:dev
  {:target :browser
   :devtools {...
              :loader-mode :default
              ...}
   ...}}}

Dustin Getz11:01:30

the “IC branch” is very stale, please upgrade to the maven release

1
wei18:01:21

ah sorry i meant i was on 4b543d46 when IC got merged

wei18:01:30

@U2DART3HA that fixed it, thanks! i see now that electric-fiddle has that line, but i'm migrating an older electric-starter-app project. so :loader-mode :default is not the default? 😅

Dustin Getz18:01:23

what does it do? I don't see it in the shadow docs https://shadow-cljs.github.io/docs/UsersGuide.html

Geoffrey Gaillard21:01:38

It's not documented. Shadow can perform hot code reload in two ways: • :eval (the default) will send compiled js code to the browser through the shadow websocket and call js/eval on it. So it sends all the code as a single string. It's fast for small programs. • :default (not the default) is the legacy method. It loads one js script per compiled namespaces. It is slower for small programs because it performs a network request per compiled namespace. It is faster for larger programs because it doesn't concatenate tons of code into a single string.

🙏 1
Dustin Getz21:01:57

we depend on this? we should talk to thomas

Dustin Getz12:01:40

@U066TMAKS please upgrade to the maven release and let us know if the issue persists, I spoke with Geoffrey and we don't think the :loader-mode :default flag is needed after IC, though we are not absolutely certain

👍 1
wei14:01:12

will report back when i upgrade, been putting it off due to the breaking websocket change

wei09:01:02

update: latest master b32ac seems to work without :loader-mode :default for my app

👍 2
braai engineer16:01:38

Will tomorrow’s talk be recorded or have a livestream for remote viewers? I want to attend remotely, but don’t see any mention on the event: https://www.meetup.com/clojure-nyc/events/298312289/

Dustin Getz17:01:17

physical event in NYC, no stream

Dustin Getz17:01:31

content will be streamed in upcoming months, this is just a dress rehearsal basically

👍 4
Vincent19:01:54

who bought bitcoin in 2013 and wants to send us all to NYC for the weekend? x)

‼️ 2
Vincent23:01:58

Hi everyone, I decided to switch to datomic and I am wondering about clj -A:dev:datomic-browser do I need to run the datomic agent for this to work and is there a specific one?

Dustin Getz01:01:09

after my NYC talk is done i will take a look at the electric fiddle demos

🔥 1
Geoffrey Gaillard17:01:32

We’ve added a readme for https://github.com/hyperfiddle/electric-fiddle/tree/main/src/datomic_browser It explains how to set datomic up and how to run it for the demo.

metal 1