Hacker News new | past | comments | ask | show | jobs | submit | typingmonkey's comments login

Is there a way to get a stream of changes out of prequel (via websocket)? That would make it possible to live-sync between the customer's devices.


Can you tell us a bit more about the type of use-case you have in mind?

We support S3 as a destination, so you could listen for changes on a given S3 bucket and pipe that to a stream (eg as outlined here [0] or here [1]).

[0]: https://aws.amazon.com/blogs/big-data/streaming-data-from-am... [1]: https://stackoverflow.com/questions/48147123/how-to-read-dat...


The use case is to build a RxDB plugin that backups the users data into the prequel api.


EventReduce - An algorithm to optimize database queries that run multiple times

https://github.com/pubkey/event-reduce


Using SQLite in the browser is great until you have users that open your app in more then one browser tab.


What's wrong with many tabs? The DB handles getting hit by many tabs correctly -- it's just as if many processes were hitting the db in a non-browser environment.

Example of syncing your app across tabs with SQLite here: https://vlcn.io/docs/guide-solving-tabs


See here: https://sqlite.org/wasm/doc/trunk/persistence.md#vfs-locking

It's mostly works with OPFS but with a few edge cases. They are working with the browser vendors on improving this in OPFS.

Alternatively run it in a SharedWorker (https://developer.mozilla.org/en-US/docs/Web/API/SharedWorke...), which seems to have made a comeback after being dropped for security concerns. Or do some sort of leader election with browser tabs and use a BroadcastChannel.


SQLite WASM uses SharedArrayBuffers and Atomics to turn async OPFS apis into blocking APIs (really just _one_ api -- getSyncAccessHandle)

Given the use of SharedArrayBuffers and that SharedArrayBuffers can't be used in a shared worker (funny), SQLite WASM doesn't work in shared workers.

If getSyncAccessHandle was made synchronous then maybe everything would just work. It'd also improve SQLite WASM perf by 30% according to their measurements [1]

[1] https://sqlite.org/forum/forumpost/af64f73911e5410cf9a640c9e...


Or many devices while data is consistent. Where is source of truth. Per user or per resource or per service. A lot of questions.


You can't write to SQLite from multiple processes either, so you mitigate that exactly the same way you do for a desktop app (i.e. show "Can't access DB for writing because other instance is running")


You can write from multiple processes and this is enabled by default (see PRAGMA locking_mode [1]). If you've got multiple writers you might have to occasionally handle SQLITE_BUSY and retry.

[1] https://www.sqlite.org/pragma.html#pragma_locking_mode


If your app cannot handle concurrency while your back-end i/o is via a machine-local singleton, that sounds like a a problem which will come up for more than just multiple tabs. If architecting around this known-fact is a challenge, an engineer may have bigger problems.


Zuckerberg will stop developing the metaverse.


I think it's too late, he bet the company on it and has no other long term plans. With the inevitable implosion of online advertising and the declining interest in FB properties I think they are going to show more signed of struggling next year.


Whatsapp will include a newsfeed before Zuckerberg ragequits the metaverse.


Messages presented out of chronological order so as not to interfere with the ad business.. can’t wait.


To not fix other peoples bugs on my github repos.


Mark Rober also gets support from the LA police while they do not care about normal peoples theft.


Resource constraints are a problem across all industries.

My recollection wrt Rober was the police aided him to help drive awareness.

For the “normal peoples theft” what would you like to police to do?


> For the “normal peoples theft” what would you like to police to do?

- show up when called.

- if they’re not going to show up, AT LEAST call back.

- make at least a token effort to apprehend someone of whom there is a clear video.

This does not seem to be outlandish expectations of the service provided by the largest line in city budget.


They could also stop civil asset forfeiture - in 2014 that surpassed burglary in the US as the top form of theft by value. Without being charged or convicted of any crime police can take cash and property, which can then be sold for funding. The case is brought against the property instead of the individual, and then to get it back they have to prove the innocence that it wasn't used in a crime, rather than the state having to prove that it was.


My guess is there are so many instances of “normal people theft” occurring that even calling back is a significant scale issue.

Basically, our criminal justice system is not built to handle minor crimes, and criminal organizations are exploiting that at scale.


Somehow they still manage to write people a lot of tickets, something that generates revenue for the police, and steal the money of legal marijuana businesses, something else that generates revenue for the police.

There are no consequences to the police for ignoring the parts of the job that do not directly generate revenue for the police.

This is not an overarching problem with "the criminal justice system" other than the fact that the police almost everywhere in the US have a culture of graft and rentseeking, and won't do anything if there isn't money or press involved.


That would only confirm that the new lichess version is faster, but not that scala3 is faster then scala2.


Isnt that what twitter has already done in the last years?


yeah, people won't ever admit that Twitter was already dead.

It's probably because many Twitter former employees lurk here on HN and can't understand why nobody is rooting for their beloved platform, of course shame on EM for his abusive behaviour, people before money, always, but nobody will miss Twitter if it really dies.

Half of what Twitter does is superfluous and the rest is badly executed.

A normal company would not survive with only 20% of the staff, Twitter might thrive, because honestly, at its core, as many have already pointed out, Twitter is “writing on a bathroom wall”.

Also: never forget that this happened and then Kashoggi was killed by the Royal Prince Bin Salman

https://www.theguardian.com/us-news/2022/aug/09/twitter-saud...

But while people are worried now that Prince Al-Walid invested 1.9 billion dollars in Musk's Twitter, they also forget that till 2020 he owned 4.6% of Twitter through the Saudi investment fund he controls, the shares were acquired in 2015, when the spy was already working for Twitter and the management had already confronted him about the issue!


I don’t think so. The tech stack is (was) quite impressive, if we don’t forget that Twitter is basically a real-time read-write database which is famously hard to scale/distribute.


WhatsApp did it for a billion daily active users (Twitter has/had more or less 200 million active users/day) with 50 engineers.

Using Erlang.

Tiwtter uses Scala that should be much more scalabale, considering the staggering amount of money spent on the JVM compared to the BEAM.


Not the same. A single tweet may need to be distributed to 50 million followers. I’m not a distributed database guy, but that to to me looks like a very different problem than what WhatsApp faces.


> Not the same. A single tweet may need to be distributed to 50 million followers

Of course not the same, but the question is, how much harder?

10 times harder?

100 times harder?

Given 1/5 of the users and probably less than 1/200 of the traffic (*) it should be feasible with less than 7,500 employees.

I don't believe WhatsApp employed the best 50 engineers in the World, I bet many of them worked at Twitter too.

(*) 100 billion messages sent via WhatsApp every day VS 500 million tweets per day


Let’s not compare all employees to devs. Twitter has (had) absolutely business critical other teams, they are a very human-facing company. Does whatsapp have to make decisions whether to ban/unban a former US president? Also, I think Twitter gets a much more uneven usage - their daily usage is lower, but peaks can be similar (~1 billion user).

Also, graph algorithm’s likely don’t scale linearly, 10 times more edges may have much much more resource usage.


> absolutely business critical other teams

So you're saying WhatsApp had no critical other teams, but Facebook bought them anyway for a record breaking sum of money at the time, because they looked nice on picture?


I don’t know, but I’m fairly sure that the user base is the most valuable part of a social network/messenger platform, not the tech stack, or the staff.


If Twitter's Grand Pubah sends one tweet, it goes to 118M people. I can't see how many times he tweets per day, but it's way over 10, and just that would generate 1.2B messages.

When Elon tweets, I'm guessing Twitter doesn't go do 118M write transactions to all his followers. But what it would have to do is flag all 118M accounts as "something as changed". Then the next time one of his followers is on Twitter, which could be a month from now, that flag means "uh oh, better go see what changed", and to do that, all of the follower's "following" accounts have to be accessed to find the change, if there is only 1 change flag per Twitter account.

If Twitter keeps a change flag per "Following" user, that makes finding changes easier, but also means lots more flags to keep updated.

Or, you could go "stateless" and not use flags, but then it seems like you'd be doing a lot of work for users who may not see it for days or months.

Way different problem than 1-on-1 messaging.


> If Twitter's Grand Pubah sends one tweet, it goes to 118M people

if my mom sends a message to the family group it goes to 50 people.

How many billion WhatsApp groups are there?

with the same constraints and problems Twitter has to face (offline users, notifications, keep users messages until they are online again, etc.)


How many people do you talk with on WhatsApp? Also, how many of those live in very very different geographical areas? I feel twitter’s graph has much more edges, and the nodes (users) can’t be partitioned as well.

Also, Twitter does real-time data analysis, which is another of their money sources, and takes a huge amount of computing.


You cannot "put stuff" on ipfs. Either you seed it or someone else does. If noone seeds it, it is gone. I bet most of it will be offline in 3 months.


This is very nit picky. The entire web works by severs “seeding” data to the client, so by your logic you can’t “put stuff” on the web. The difference with torrents and IPFS is you can have multiple servers seeding the same content, and not be dependent on any one.

I’m not making any predictions about how long Z library stays up, but the illegal seeding of movies and tv shows has remained very strong until today.


IPFS is actually worse to put stuff in than the web or torrents, in my experience.

Last time I tried it, the ipfs service used its own storage scheme. Meaning it's not like pointing Apache at a directory. You take your stuff, and upload it into ipfsd first, and it puts that data into its storage system.

So to do this from scratch (not mirroring somebody else's content) needs a minimum of >62TB -- 31TB of content, which ipfsd will then package into 31TB more + overhead in its storage area.

And of course if you're doing this, you're expecting other people to mirror this stuff, so count on hundreds of terabytes of traffic.

So this is easily ~$3K in hard disks alone, plus the NAS/server hardware, plus traffic, plus the willingness to risk the FBI coming and grabbing all of it.


I know the pain of having to store the payload multiple times when using system like ipfs and zeronet.

It maybe helpful to leave the files in the file system as is, and store the metadata in a sqlite database.

Then integrate it with a p2p network layer for crowd seeding and even content discovery.


IPFS isn't my favourite tool either but you are wrong.

> So to do this from scratch (not mirroring somebody else's content) needs a minimum of >62TB -- 31TB of content, which ipfsd will then package into 31TB more + overhead in its storage area.

IPFS has `nocopy` option for quite some time now, which avoids copying.

> And of course if you're doing this, you're expecting other people to mirror this stuff, so count on hundreds of terabytes of traffic.

Of course you are expecting other people to mirror this stuff, and naturally that will generate some traffic. How is this not a problem with web mirrors or torrents?


> IPFS has `nocopy` option for quite some time now, which avoids copying.

Oh, didn't find about that one. Thanks!

> Of course you are expecting other people to mirror this stuff, and naturally that will generate some traffic. How is this not a problem with web mirrors or torrents?

I mean, if I put a book archive on the web, I'd expect the vast majority of people to just grab whichever book they were interested in. Mirroring is a possibility, but a non-trivial thing to accomplish, and can be discouraged.

Meanwhile, on IPFS I'd expect a much higher likelihood of somebody trying to replicate the whole archive, so one would do well to keep that in mind and to be prepared for it.


You're welcome!

Re #2: Perhaps that's true, but on the other hand, the load will be distributed across all seeders with IPFS whereas your web server will be the only one shouldering it.


Fair point. From my experience people often think ipfs works equal to sth like a shared drive or filecoin, so I had to point that out.


That’s clear from the article, which is about the nontrivial task of making tens of terabytes of data available on IPFS.


> … "If noone seeds it, it is gone." …

This is a very good argument for primarily using ipfs to host high quality content that people will want to preserve long-term…


people are pinning stuff on ipfs with filecoin

there is a free service that does this for you till like 5 gigabits, it pins with filecoin

https://web3.storage/pricing/

I have entire sites hosted for free this way, whereas other hosts like vercel and netlify will charge you for traffic. you can just put your big assets on ipfs+filecoin pins and have unlimited traffic. the ipfs CDNs help with performance.


Interesting. How does the CDN work as web browsers are not yet natively supporting IPFS? Is someone operating the CDN?


The gateways are https, choose one that caches on its own, like cloudflare’s


IPFS is a caching or distributing layer, not a persistent storage. There are some attempts to make a storage that backs IPFS by Filecoin team (Filecoin and IPFS teams have a lot of overlap.)


Isn't that true of anything shared on a network?


Yes, but there are people who claim that IPFS is uncensorable or permanent. I saw that a lot from NFT salespeople who were claiming you’d own something forever with no further payments needed, or even that a copyright claim couldn’t take it down.


See also the Event-Reduce algorithm which is a more lightweigt version of the similar principle. https://github.com/pubkey/event-reduce


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: