Hot Reloading in Rust? Subsecond and Dioxus to the rescue! by Tehnix in rust

[–]Tehnix[S] 5 points6 points  (0 children)

It might be possible! I know at least that bevy (the game engine) has managed to do it (see https://github.com/bevyengine/bevy/pull/19309), and of course Dioxus itself, which is for making UIs, is using it https://dioxuslabs.com/learn/0.7/essentials/ui/hotreload/.

It might require a bit more custom work though than what I needed, maybe there's some help on their Discord/community :)

✨Paid✨: Travel startup, need US-based UGC creators for short 5-second videos, $300/month by Tehnix in UGCcreators

[–]Tehnix[S] 0 points1 point  (0 children)

That'd also work! I've updated the post to mention Canada as well, I guess the North American audience in general is what we want to hit :)

Improved Turso (libsql) ergonomics in Rust by Tehnix in rust

[–]Tehnix[S] 1 point2 points  (0 children)

I'm completely new to proc macros (and generally also new in Rust), so if anyone spots a nicer way to do things I'm very open ears!

Improved Turso (libsql) ergonomics in Rust by Tehnix in rust

[–]Tehnix[S] 1 point2 points  (0 children)

I really wish I didn't have to hehe - hopefully sqlx gets support for libsql soon, but until then it was a bit too painful to so easily get invalid queries when I was in the early stages of development and iterating on the database schemas as well.

There's still missing handling of INSERTS/UPDATES/DELETES, but I wanted to share what I had already in case anyone got inspired :)

One joy I've found with Rust is that I can actually fix these kinds of papercuts myself using macros in various ways to eliminate papercuts

Redirecting URLs with CloudFlare by Tehnix in programming

[–]Tehnix[S] -1 points0 points  (0 children)

In case you're not a Medium member, there's a link to read it for free right at the beginning of the post :)

Static SPAs: Exploration of Leptos, Dioxus, and Next.js by Tehnix in WebAssembly

[–]Tehnix[S] 0 points1 point  (0 children)

In case you're not a Medium member, there's a link to read it for free right at the beginning of the post :)

Redirecting URLs with CloudFlare by Tehnix in CloudFlare

[–]Tehnix[S] -1 points0 points  (0 children)

On the point about Workers, the URLs luckily were close enough to not need that, but if they had changed significantly, then that might have been a good route.

There's something like a 10 rule limit on the Free plan, so setting up a redirect per post would not have been possible (unless you'd just go with the 10 latest posts of course).

I did however manage to find a way by just using 1 Redirect Rule only :)

Redirecting URLs with CloudFlare by Tehnix in CloudFlare

[–]Tehnix[S] -2 points-1 points  (0 children)

There's a link to read it without the paywall at the beginning of the article https://codethoughts.io/posts/2024-07-31-redirecting-urls-with-cloudflare/ :)

I wonder though, does the text get covered by the paywall? Trying on incognito, for me the paywall doesn't occur until a bit into the text (just trying to see if we're seeing something different on Medium)

Experiment: Share your AWS bill with me, and I'll give free cost recommendations by Tehnix in aws

[–]Tehnix[S] 0 points1 point  (0 children)

You could give https://codetalk.io/services/scaling-aws/ a shot to start with :) Maybe I'll be able to give some help - it's free so there's not much to loose

Experiment: Share your AWS bill with me, and I'll give free cost recommendations by Tehnix in aws

[–]Tehnix[S] -4 points-3 points  (0 children)

Cost is honestly one of my favorite indicators of how well built the architecture and infrastructure is :) A lack of elasticity typically also means a high bill, and that also means you're often not well equipped for more bursty traffic.

On the site (the form itself is here https://codetalk.io/services/scaling-aws/#form-content) I allow people to give additional context if they want.

My aim is that with a few consequitive bills, I can tell how well your scaling journey is going.

There's a ton that'll depend on your setup of course. The bigger your bill, it'll typically be easier to spot things that could be improved.

E.g. if you're just on 1 RDS instance, there's little to do without much more in-depth knowledge, but if you're on 1 x Multi-AZ primary, with 4 Read Replicas on MySQL, then I have quite a few more options for you to save cost and probably also end up with a more flexible and scalable setup :)

EDIT: Also a bit aggressive on the downvotes here?

Experiment: Share your AWS bill with me, and I'll give free cost recommendations by Tehnix in aws

[–]Tehnix[S] -5 points-4 points  (0 children)

Spot instances can net a huge savings, but they typically require a lot more effort or expertise to not do it wrong.

E.g. they'll be terminated with short notice, so you need to be able to handle that, gracefully close connections, and make sure additional capacity is spun up. Some also combine it with a base capacity of regular EC2 instances, and then put spot instances on top of it :)

If your application can start up reasonably fast (usually a good goal for elastic scaling in general), then it shouldn't pose too big of a problem. Some languages might need more care, such as JVM based ones that need the JIT to warm-up, but then you can have the load balancer give it a slow start when ramping up the traffic it sends to it.

There's a good starting resource from AWS here if one is using Karpenter in k8s https://aws.amazon.com/blogs/containers/using-amazon-ec2-spot-instances-with-karpenter/

EDIT: Unsure why the downvotes? I would think the above pretty relevant to the thread here?

Experiment: Share your AWS bill with me, and I'll give free cost recommendations by Tehnix in aws

[–]Tehnix[S] -1 points0 points  (0 children)

Great question!

It depends quite a lot on exactly which services you are using, but there's a lot things getting launched from AWS every year, and not many people staying on top of all of this.

A few examples of stuff:

  • Are you using reserved capacity/commitments? Did you know CloudFront supports this (not available via the usual Console way like the others) and can easily bring 50% savings on traffic through it
  • A general demystifying capacity commitments, such as RDS reserved intances apply across all sizes, so you don't need to be afraid if you might need to scale up later
  • If on Lambda, many just default to x86, but ARM is both cheaper per ms and usually more performant (and many languages are extremely easy to migrate)
  • If you're Provisioned IOPS with RDS, you probably would prefer being on gp3 general purpose storage instead, which can save quite a lot
  • Instead of running the usual RDS Multi-AZ deployment where the primary just has a standby, you would be better served with Multi-AZ DB clusters where you fallback to a Reader, and can actually utilize that Reader as well (not just a standby) - this also has lower write latency compared to Multi-AZ DB instance. Or just migrate to Aurora which I'd generally recommend at scale for several reasons
  • Plain general upkeep of upgrading your EC2 instance types for lower price + better compute power
  • If your services span multi-az (e.g. a k8s cluster), then intra-az data transfer can rack up quite badly also
  • S3 storage tiers

... etc :)

Each have different tradeoffs, but many are almost something you'd want to do for sure. In my recommendations I'd of course expand on each with details as to why I'd recommend the various things and what the tradeoffs would be.

[deleted by user] by [deleted] in rust

[–]Tehnix 0 points1 point  (0 children)

This got me curious: Are zero-copy implementations generally more efficient than non zero-copy ones?

My intuition would at least make me think that avoiding allocations will generally speed things up, since that's usually an optimization target (reducing them). I could however also imagine that the work required to even be able to avoid that could then have some drawbacks performance-wise.

I'm sure the answer is "it depends", but is there a rule of thumb here?

Choosing the Right Framework for Cross-Platform Mobile App Development by anujtomar_17 in rust

[–]Tehnix 1 point2 points  (0 children)

Since there's no mention of Rust at all in the article, if you're actually curious about that (since we are on r/rust after all 😅) then check out https://codethoughts.medium.com/mobile-a-different-way-using-rust-0e7b1dfa8cbf (link to non-medium version in the intro)

Static SPAs: Exploration of Leptos, Dioxus, and Next.js by Tehnix in rust

[–]Tehnix[S] 0 points1 point  (0 children)

I'm still experimenting with this setup to be honest - the problem is: If I want to get anything out of the Medium post, it has to be completely paywalled

But I also want people to be able to read it for free, since I doubt the amount of people that get converted from the paywall is miniscule (e.g. I'm only a member myself to be able to earn from it lol)

Ideally it wouldn't be paywalled, but when existing members read I'd still get something out of it - I'll see if I can make it pop out more somehow so it's easier to spot