5 ms·
The blog is just hugo so it's 100% static files over nginx. The search engine is serverside-rendered mustache templates via handlebars[1], via served via spark
by marginalia_nu 3y ago
The blog is just hugo so it's 100% static files over nginx.
The search engine is serverside-rendered mustache templates via handlebars[1], via served via spark[2]. It's basically all vanilla Java. I do raw SQL queries instead of ORM, which makes it quite a bit snappier than most Java applications. The sheer size of the database also mandates that basically every query is a primary key lookup. The code is written around that constraint.
Although the search engine is a bit on the slow side since it's routed through cloudflare and I think I'm relatively far away from the closest datacenter so it adds like 100ms to the load times.
[1] https://github.com/jknack/handlebars.java https://github.com/jknack/handlebars.java
[2] https://sparkjava.com/ https://sparkjava.com/
- lucideer 3y ago> The blog is just hugo Yeah the static stuff being fast is less surprising - it was mainly the search results page that astounded me. > via served via spark[2] Had not heard of this Spark (only the other Apache one). Will definitely take a look. > Although the search engine is a bit on the slow side since it's routed through cloudflare and I think I'm relatively far away from the closest datacenter so it adds like 100ms to the load times. I've hit the CF loading screen which introduces a big delay, but when I don't see that the loading is really instantaneous.
- marginalia_nu 3y agoI think overall the system is just really well optimized. It needs to be given I'm working with finite hardware.
- lucideer 3y agoIt's incredibly impressive. Well done.
- playingalong 3y agoWatch out for Spark. If not dead, it went into some kind of hiatus. Little activity recently.
- marginalia_nu 3y agoDunno what I'd want to change though. If worse comes to worst, I'll fork it and keep the dependencies up to date.
- lucideer 3y agoFor anything handling user input I'd be concerned about maintenance status for fixes. Even beyond the codebase itself, even just maintaining an up to date pom.xml can be important - seems theirs was last updated in July of last year. Very brief manual browse of it shows potential exposure to things like https://nvd.nist.gov/vuln/detail/CVE-2022-25647 https://nvd.nist.gov/vuln/detail/CVE-2022-25647 - not sure if that's reachable in the codebase but there could be others.
- brabel 3y agoYes, and it was not that well designed to be honest... the successor is quite a lot nicer and it's called Javalin[1]. Same philosophy but just got things right where Spark, being the "first" (in the Java world, using the design inherited by Sinatra[2]) had a few design issues. [1] https://javalin.io/ https://javalin.io/ [2] https://sinatrarb.com/ https://sinatrarb.com/
- aragilar 3y agoThat seems to be the status of the whole hadoop ecosystem unfortunately (we're switching away from it at work).
- playingalong 3y agoDoes the library have anything to do with Hadoop? Are we talking of the same Spark?
- aragilar 3y agohttps://en.wikipedia.org/wiki/Apache_Spark https://en.wikipedia.org/wiki/Apache_Spark right? My understanding was it was built on Hadoop (https://en.wikipedia.org/wiki/Apache_Hadoop https://en.wikipedia.org/wiki/Apache_Hadoop) infrastructure.
- ericbarrett 3y ago> I do raw SQL queries instead of ORM Love it. I've seen so many cases where engineers with just basic SQL knowledge (like myself; I'm no JOIN god) can run circles around the queries ORMs generate.
- brazzy 3y agoORMs are great to spare you from writing heaps of error-prone boilerplate mapping code. Which is kinda what they are for, that's why they're called "Object-Relational Mappers". Not "Object-Relational Query Generators". Because they suck at the latter.
- klysm 3y agoUsually they’re not even really relational mappers, but table mappers.
- throwaway744678 3y agoNot sure what you mean: (in a rdms) a table is a relation.
- klysm 3y agoYes exactly. ORMs are usually only good at representing tables, not general relations.
- deleted 3y ago[deleted]
- stolsvik 3y agoORMs help you the first three weeks. After that it is a lead ball around both feets, dragging you down into dark pits of bad performance, incomprehensible relations, and impossible debugging. That anyone with more than 6 months of experience still drag Hibernate up from their chest is just absolutely beyond my comprehension.
- ignoramous 3y agoCurious: Do you have plans to bring in FOSS LLMs for summarization and Q&A style queries anytime in the coming months? Btw, I was half expecting that you quit because of FUTO grants (saw your post on their forums), but I guess it wasn't that. Either ways, rooting for you!
- marginalia_nu 3y agoNot in the short term, if for no other reason than not having the hardware for it. Maybe down the line. Would be neat if someone who was into that sort of stuff wanted to integrate with Marginalia though. I've got a free API ;-) I do think LLMs has the potential to integrate well with search engines and I'd love to see a sort of open source search ecosystem emerge with different projects collaborating to exceed the sum of their parts. Yeah I was in talks with FUTO and they agreed to help the project out a bit, I won't say more until I have money in hand. It's taking a while but it's not on their end, I just need to sort out some legal stuff first.
- srazzaque 3y ago> It's basically all vanilla Java Have you considered rewriting it in rust? ;) In all seriousness, it's great to see something written in a "boring" language like Java, which seems to get a lot of hate in developer circles, hover at the top of HN. Java really can perform amazingly well, especially if you minimise the use of unneeded libraries and frameworks. Super curious to see how your stack evolves as you get more load. Best of luck to you on the journey! Ps there's truly a world of difference between "Spring Boot Developer" and "Software Engineer with Java experience". I suspect a lot of people who hate Java or think it performs badly have only worked with the former group of people.
- marginalia_nu 3y agoI'm a believer in the conservation of cool. You can build something cool in a boring language, or build something mundane in a cool language. Java gets a lot of shit, some of it is merited but a lot of it isn't really fair to the language. There's a lot of Java developers that are kinda shit-tier copy-paste developers developing shit-tier copy-paste applications, because the language is so forgiving as to accommodate that, but it's also a competent language that you can do seriously impressive things with. You can be insanely productive in Java because it's extremely stable and mature. You almost never have to deal with library churn or other upstream changes that urgently needs to be fixed. I can think of exactly two instances in my professional life that's happened, migrating off Java 1.8 and the oh-shit moment of needing to patch log4shell.
- bullen 3y agoDid you look at http://github.com/tinspin/rupy http://github.com/tinspin/rupy?
- the-smug-one 3y agoWhich version of Java are you running?
- marginalia_nu 3y agoI'm on 18, but will upgrade to 21 when it drops. Not really felt the need to upgrade to 19 or 20 as they haven't provided any features I'm interested in.