https://discord.cloudflare.com logo
Join Discord
Powered by
# workers-discussions
  • a

    adinetech.eth

    01/18/2021, 4:27 PM
    Totally Chennai PoP not resolving DNS Request , instead it resolving on Mumbai So latency will increase 65%
  • a

    adinetech.eth

    01/18/2021, 4:27 PM
    Anyways Thanks for your response :)
  • a

    alwaysal96

    01/18/2021, 5:38 PM
    Hey Cloudflare team! Canadian startup founder here, working with another developer to deliver desktop-quality games in the browser via WebAssembly/WebGL, and we're evaluating using Workers and/or Pages to deploy our compiled game binaries at the edge for low latency and fast startup times to benefit developers on our platform as well as gamers
  • a

    alwaysal96

    01/18/2021, 5:41 PM
    We're currently working on a multiplayer FPS meant to serve as a technical showcase as what's possible, and have a few questions for the team
  • a

    alwaysal96

    01/18/2021, 5:45 PM
    Which service would be better suited for our needs, Pages or Workers? I know pages is based on a jamstack like framework, so if I understand right we could embed our wasm binary as the compute intensive bytecode portion for the heavy lifiting, and have that mesh with a lightweight JS UI
  • i

    itsmatteomanf

    01/18/2021, 5:50 PM
    If you need it delivered to the user I feel it's not much different, one is more customizable directly (Workers), but less automated. Pages is automatically integrated with GitHub with automatic deployments of branches.
  • i

    itsmatteomanf

    01/18/2021, 5:50 PM
    If you need it run on the edge then Workers directly is the way to go...
  • a

    alwaysal96

    01/18/2021, 6:09 PM
    Thanks for confirming that, we'll be going with Workers in that case 🙂 @User
  • m

    Michael Sørensen

    01/18/2021, 6:59 PM
    Hello. Michael from Denmark here. I’m new with workers and wondering how it can be used for batching work? Like processing many Items concurrently. I’m considering taking a list of work and divide it out by 50 (outgoing calls) recursively until the bit of work is less than 50 and then send the 50 requests times many to a worker doing the actual work. Then collect it all the way back. Are there any other way of making new workers to handle a load?
  • i

    itsmatteomanf

    01/18/2021, 7:51 PM
    https://developers.cloudflare.com/workers/examples/aggregate-requests
  • m

    Michael Sørensen

    01/18/2021, 7:53 PM
    Yes. That’s what I thought. So that’s the way to go, to have workers do for instance 1000 “work”? Just make 20 requests with 50 each, which in turn calls a worker that does the work.
  • i

    itsmatteomanf

    01/18/2021, 8:06 PM
    Yeah, that would work. Make sure you stay within the CPU limits...
  • m

    Michael Sørensen

    01/18/2021, 8:07 PM
    Yes. I’m aware of those, although at the moment I have no feel for what can be done in 50ms.
  • i

    itsmatteomanf

    01/18/2021, 8:09 PM
    Quite a few things, but you should test in moderate scale to check the average. JSON has limits in the total size parsed, for example. Waiting for replies isn't CPU time basically.
  • m

    Michael Sørensen

    01/18/2021, 8:11 PM
    I’ll just have to experiment a bit. I’ve read that workers can share state. Is each worker in each DC a singleton that share variables in global scope?
  • m

    Michael Sørensen

    01/18/2021, 8:11 PM
    Before the stateful objects coming soon.
  • g

    Greg Brimble | Cloudflare Pages

    01/18/2021, 8:12 PM
    KV is the best way to share state between workers right now.
  • g

    Greg Brimble | Cloudflare Pages

    01/18/2021, 8:13 PM
    Global scope stuff can be evicted at any time, so you shouldn't rely on it.
  • m

    Michael Sørensen

    01/18/2021, 8:14 PM
    That’s what I gathered. But good to know that there is a global scope, so I don’t inadvertently contaminate.
  • t

    theGagne

    01/18/2021, 9:24 PM
    Another way to distribute work is with crons... Run a cron looking for work, cron runs every x often and looks for next y set of data to process
  • t

    theGagne

    01/18/2021, 9:44 PM
    You can also kind of schedule stuff w/ crons and KV - set a key for a specific time (or an object with multiple times) and have every cron check to see if it's in that next interval, and if so, process it.
  • w

    warvstar

    01/19/2021, 12:50 AM
    I thought Workers were only used for short running tasks? ie under 50ms? Is it possible to have a long running and say 5mb wasm binary (game) delivered through it?
  • i

    itsmatteomanf

    01/19/2021, 12:52 AM
    I believe the limit of uploaded WASM is the same as the normal script, so 1MB. Delivering to the user, the sky is the limit (and the 50ms, unless you use Workers Unbound, but it's private beta now).
  • i

    itsmatteomanf

    01/19/2021, 12:53 AM
    How long running?
  • w

    warvstar

    01/19/2021, 12:53 AM
    So the wasm binary would continue to run as long as the user was playing the game, minutes or hours I suppose.
  • i

    itsmatteomanf

    01/19/2021, 12:55 AM
    If it's delivered and run in the browser, it would run within the user's browser. If run within the Worker (which wouldn't run a full game, but each request is separate, it's limited to 50ms.
  • w

    warvstar

    01/19/2021, 12:57 AM
    Ah okay, thanks for the info. I also have a question on a custom file(asset) server. Say I have a custom file server that keeps files in memory, is there a service that could be used to keep this server at edge locations? Is this something that Pages would be good for?
  • i

    itsmatteomanf

    01/19/2021, 12:59 AM
    Pages is basically a KV wrapper, you could use KV which would keep the various keys "hot" in all locations where there is a suffience number of requests. Alternatively the normal cache would work if they are not unique files per user on the same URL.
  • i

    itsmatteomanf

    01/19/2021, 12:59 AM
    If you require files to be at all locations you would need a push CDN, not a pull one like Cloudflare.
  • i

    itsmatteomanf

    01/19/2021, 1:00 AM
    Note: KV has some limits and is eventually consistent, geared towards high read, low write operations.
1...606162...2509Latest