Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Mar 31 15:46
    VeaaC commented #1405
  • Mar 31 11:07
    pfrenssen commented #1432
  • Mar 31 10:17
    sergeysova commented #1432
  • Mar 31 10:17
    sergeysova commented #1432
  • Mar 31 03:28
    masnagam commented #372
  • Mar 30 16:47
    Jonathas-Conceicao commented #372
  • Mar 30 16:42
    Jonathas-Conceicao commented #372
  • Mar 30 16:41
    Jonathas-Conceicao labeled #372
  • Mar 30 15:29
    masnagam opened #372
  • Mar 30 15:05
    djahandarie opened #1434
  • Mar 30 14:46
    otavio commented #1430
  • Mar 30 14:40
    robjtede commented #1433
  • Mar 30 14:39
    robjtede commented #1430
  • Mar 30 14:15
    otavio commented #1430
  • Mar 30 14:11
    robjtede commented #1430
  • Mar 30 14:11
    robjtede commented #1430
  • Mar 30 14:11
    robjtede commented #1430
  • Mar 30 13:58
    otavio commented #1430
  • Mar 29 10:27
    pfrenssen commented #1432
  • Mar 29 07:49
    GopherJ commented #371
brockelmore
@brockelmore
that cuts the line of all other messages essentially
Mihail Malo
@qm3ster
@brockelmore for what PURRposes?
(because if it needs to deterministically cut in line, that's a race)
brockelmore
@brockelmore
just so that if the actor has a long mailbox, its not waiting for everything to get done before then. not deterministic, just a priority system that if it sees it has msgs in the priority box it would process those prior to the other one
and that second mailbox wouldnt depend on the other mailbox in anyway really. i could just split it into a different actor but the logic i use is already in the one actor
Mihail Malo
@qm3ster
Logic doesn't matter, you can make reusable structs/functions. What really matters is whether they have to mutate the same state
brockelmore
@brockelmore
no mutations - just business logic
immutable fns on self
Mihail Malo
@qm3ster
If there's no state, does it need to be an actor? :thinking:
brockelmore
@brockelmore
read no write
Mihail Malo
@qm3ster
Ah, read yes! And how did the state get in there?
brockelmore
@brockelmore
msgs come in via mailbox to update state. some msgs are for state updates others are just computation. i dont really care about pending messages when its a computation request
(even if those pending messages could update state)
Mihail Malo
@qm3ster
Yes, I totally get that usecase
And the updates really do queue up? (given they are pure computation + update of memory state)
Or do they do network or disk IO?
brockelmore
@brockelmore
incoming messages are the result of network/disk io (both) that then get passed to the actor so it is quite "clumpy"
and its in blockchain so messages are particularly clumped more than most systems
Mihail Malo
@qm3ster
Ah, you mean they come in bursts from outside?
brockelmore
@brockelmore
yeah
Mihail Malo
@qm3ster
Right, so it's not that they're expensive for this actor to process, they just come in huge numbers
brockelmore
@brockelmore
exactly
and if i try to send a computation right after a dump, it can be slow
because its stuck in the queue
(i dont always try to do that, but it does happen)
Mihail Malo
@qm3ster
Maybe for this usecase you should use some data structure like a concurrent map where the write side gets flushed to the read side when idle?
It basically sounds like you should have "read cache" agents, at whatever scale, but the question is how to update those. If most of those messages in the dump change the state, and the state is one big structure, then streaming them from the update agent would be just as intense
(unless the update agent does some cpu-intensive things, it is a blockchain after all, in which case the cpu-time of the update agent would naturally throttle the clean update messages without any checking)
brockelmore
@brockelmore
yeah ive thought about using more sophisticated data structures but just wanted to make sure there wasnt a way to keep basically what i have and just add a second mailbox. tbh its not life or death right now, so will be another thing on my todo list down the line. the update agent isnt very computationally intensive. appreciate your input
Mihail Malo
@qm3ster
I'd get more feedback, I am not super experienced with actix.
But what I understand of it is that they abstract the task event loop of the actor from you, asking you to implement their handler functions instead.
Which is easy to understand and organized, but likely precludes such things as simply having a priority channel, since you aren't in control of the site where your mailbox channel is being awaited.
Andrey Cherkashin
@andoriyu
@Jonathas-Conceicao how do i chain actor futures?
Jonathas Conceição
@Jonathas-Conceicao
There's both a map combinator for mapping a result and a then combinator for waiting for a asynchronous value.
James
@avitex
Afternoon folks
Damon Rolfs
@dmrolfs
Hi. I’m learning rust and Actix (v0.8), so please excuse me if this is obvious. I’d appreciate guidance on how I can hide the usage of Actix actors (i.e., actors, arbiters, system, etc) behind a function. I am hoping to define the function to return the actor’s response as a Future. Every example and project I’ve found uses actin actors within the context of actix-web or the trivial example that println! the result within the arbiter spawn. Any guidance is appreciated! Articles, example projects, tests. Etc. Thanks in advance!
Andrey Cherkashin
@andoriyu
had bunch of issues with just map and then. Anyway, I solved it by moving semaphore into the future, rather than actor.
Andrey Cherkashin
@andoriyu
@dmrolfs since those are actors you need to know an address of an actor and use send/do_send/try_send to send a message to an actor.
@dmrolfs https://github.com/andoriyu/gazpacho/blob/master/src/daemon/system.rs#L22-L25 pretty trivial example of sending a message from outside of actix system
apocello2008
@apocello2008
Hello! I'm start using Rust with library Actix-web. When i build sample server (from example) i have a 50k rps for localhost http =( Build with --release maybe somebody can help =(
Rob Ede
@robjtede
@apocello2008 what’s your issue?
apocello2008
@apocello2008
@robjtede In TechEmpower bench actix-web made 7kk rps. But in GitHub example just 50k. Maybe actix have some "flags" or tricks with code or compile..
Andrey Cherkashin
@andoriyu

@Jonathas-Conceicao I'm still confused about map vs then. I get that Map changes the result on previous future and is a future itself.
Then is also a future and runs after the previous future as well with the result of previous future.

Both run regardless of previous future outcome since error handling was taken out of futures. If I understand correctly: Map changes result type and Then needs to keep the same output.

@apocello2008 well, first bench-marking localhost isn't a good idea. Just because loopback pipe is infinite bandwidth doesn't mean your have infinite resources.
Then what is your test bench look like compared to the one used in TE.
Rob Ede
@robjtede
Yeah I wouldn’t worry about it.
Nikhil Jha
@nikhiljha
Is there an alternative to https://docs.rs/actix-web/0.4.2/actix_web/middleware/csrf/index.html in newer versions of actix-web?
Damon Rolfs
@dmrolfs
Thanks @andoriyu. I’m not having difficulty issuing the sends but rather getting the results. I’m new to it but it seems at this point in time there’s fluid, incongruent developments wrt future runtimes, or very possibly I’m unable to get the implementation using both tower-based grpc framework and actix (v0.8). I think for today I’ll implement an HTTP endpoint using actix-web until I can properly regroup for the desired gRPC. thanks again
Andrey Cherkashin
@andoriyu
@dmrolfs as long as future version match between tonic and actix. When you send a message you get a future in return. Resolve that future just like any other future.
Spencer Judge
@Sushisource
In the context of an actix-web handler which is not async, and returns an HttpResponse, if I have inside that handler some library I'm using that is async, how might I block_on that future, or otherwise wait for it? I intend to simply migrate all my handlers to async, but that's a lot of stuff to do and I'd like to be able to have an intermediate option. So far everything I try complains that I'm starting a runtime in a runtime, which makes perfect sense. I've been looking for how to ask for the extant one from actix, but I can't find anything. Thanks for any advice!
Bojan Šernek
@baadc0de
hey guys, please excuse one noob actix question. I use a library that makes futures and I can ctx.spawn that with fut::wrap_future. But how can I get to the return value? Everything is 'static and Output = ()..