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

    macedonian

    01/17/2021, 3:23 PM
    I would also like to get more technical details about this.
  • m

    macedonian

    01/17/2021, 3:25 PM
    I noticed increased latency (>300ms) when the JS of the worker gets very big, but the CPU time in the dashboard was still very low (~5ms).
  • y

    youngking

    01/17/2021, 3:40 PM
    https://developers.cloudflare.com/workers/platform/limits#cpu-runtime According to the docs, latency should not be correlated with cpu runtime. But if you actually face the situation, I think there is a bug.
  • c

    cproetti

    01/17/2021, 3:46 PM
    Oh wow they increased the Cache Max object size. I’m sure it was 50 MB, I wonder when this was changed?
  • y

    youngking

    01/17/2021, 3:53 PM
    http://web.archive.org/web/20200821164009/https://developers.cloudflare.com/workers/platform/limits#cache-api-limits At least since August
  • y

    youngking

    01/17/2021, 3:54 PM
    no earlier history is available
  • c

    cproetti

    01/17/2021, 3:54 PM
    Are you referring to the CPU time vs real-time under the CPU runtime section of the linked document?
  • y

    youngking

    01/17/2021, 3:56 PM
    yep. Latency only refer to so-called realtime as I understand
  • c

    cproetti

    01/17/2021, 3:57 PM
    Yes, but doesn’t mean having a connection open for longer doesn’t require more CPU time
  • y

    youngking

    01/17/2021, 3:58 PM
    right, so I also wanna know the answer to your question
  • c

    cproetti

    01/17/2021, 3:59 PM
    👍
  • y

    youngking

    01/17/2021, 4:01 PM
    I also wonder that besides javascript execution time, what else affect cpu time
  • y

    youngking

    01/17/2021, 4:03 PM
    But why this problem bother you? I think the latency is the biggest problem when serving to mainland China. If cf doesnt abort your cpu usage, then cpu time can be ignore.
  • y

    youngking

    01/17/2021, 4:04 PM
    @User
  • c

    cproetti

    01/17/2021, 4:08 PM
    Doesn’t bother me, I just want clarification. After noticing wild swings in CPU time I eventually found a correlation between China users and world users that I tested be copying a script and using a different domain for one set if users to another. I’d just like clarification around this so I can better understand it. If we had a clearer understanding from the beginning then I would have known the answer right way instead of having to guess and test the “issue” over the course of a month.
  • c

    cproetti

    01/17/2021, 4:09 PM
    Again, I’ll mention this is only observer in my case with a non-enterprise account where i’m running personal projects.
  • g

    Greg Brimble | Cloudflare Pages

    01/17/2021, 4:11 PM
    There's no reasonable way to use HTMLRewriter as a DOM parser, right? I want to extract the inner text of some (specific types of) nodes, but I need to use some other library, right?
  • i

    itsmatteomanf

    01/17/2021, 4:13 PM
    Looking at the docs it seems there is only a way to set the inner content and not get it, unlike attributes. Not sure if it's a missing thing in the docs or actually not there.
  • g

    Greg Brimble | Cloudflare Pages

    01/17/2021, 4:14 PM
    Yeah, I was slightly surprised that it didn't seem possible (hence me double-checking in here, in case I was just being an idiot)
  • i

    itsmatteomanf

    01/17/2021, 4:15 PM
    Can't find in the docs. Not sure if it's quicker to check the code or mention someone like @User or @User 🙂
  • i

    itsmatteomanf

    01/17/2021, 4:20 PM
    @User reading more, I believe it's handled in the "text chucnks" section... It does't exist as it's not guaranteeing getting all the text in one chunk.
  • i

    itsmatteomanf

    01/17/2021, 4:20 PM
    https://developers.cloudflare.com/workers/runtime-apis/html-rewriter#text-chunks
  • g

    Greg Brimble | Cloudflare Pages

    01/17/2021, 4:21 PM
    Yeah, but I can't figure out how I get the element that that text came from though.
  • g

    Greg Brimble | Cloudflare Pages

    01/17/2021, 4:21 PM
    So if there's multiple elements, I can't tell which piece of text goes in which element.
  • i

    itsmatteomanf

    01/17/2021, 4:22 PM
    Could it be that you do a
    .on()
    for a specific element it launches the handler for the element and then text in the same call? Never totally used HTMLRewriter for this use case...
  • j

    James

    01/17/2021, 4:23 PM
    It’s been a while since I used HTMLRewriter but I believe I did something similar by just looking at *, storing the current element as it recurses through, and then looking at the last seen element.
  • g

    Greg Brimble | Cloudflare Pages

    01/17/2021, 4:24 PM
    Ah, does it do everything in order?
  • j

    James

    01/17/2021, 4:24 PM
    And then doing my filtering in the element function directly, looking at tagName, etc. A bit inefficient, but functional.
  • j

    James

    01/17/2021, 4:24 PM
    As far as I recall, yes. Someone feel free to correct me though.
  • g

    Greg Brimble | Cloudflare Pages

    01/17/2021, 10:42 PM
    I officially concede. I can't make HTMLRewriter work as a parser. If you've got that code somewhere @User , I'd love to see it at some point (no worries if not). But I'm just going to find a library to do it for me.
1...575859...2509Latest