A "Try for free" click shouldn't cost a first-time buyer $1.26 and five minutes
Every Actor we publish has a health check that answers one question: does a real run return real rows? Two of our Actors passed that check every time. Neither was "broken" by any test that only looks at correctness. What that check can't see is the version of the same run a first-time visitor actually makes: the one where they click "Try for free" and send an empty input, because they haven't…
The wire material describes two instances where a "Try for free" click on an actor (ATS job board scraper and Google News scraper) inadvertently cost first-time buyers $1.26 and five minutes, despite the actors themselves being correctly functional. Both issues stemmed from default settings that were not scrutinized before deployment.
In the first case, the ATS job board scraper defaulted to crawling seven companies, pulling up to 500 jobs per company. This resulted in sequential HTTP requests, leading to a total runtime of 313 seconds and a cost of $1.26 before any rows were returned. The fix involved lowering the default maximum jobs per company from 500 to 50 and the maximum results from 2000 to 300, reducing the runtime to 90 seconds and the cost to $0.0056.
Similarly, the Google News scraper defaulted to 100 items per query, which, combined with sequential URL decoding, resulted in a runtime of 277 seconds. The fix was to lower the default maxItemsPerQuery from 100 to 50 (while keeping the maximum at 100) and re-measured the runtime to 139 seconds. The re-checked live deployment further reduced the runtime to 139 seconds.
These fixes demonstrate the importance of considering defaults in API design, as they can significantly impact user experience and cost. The article emphasizes that defaults should be judged based on their impact on the user, not just their technical correctness. It also highlights a simple method to check default performance: run the default input for real, measure the actual usage time and cost, and adjust the defaults accordingly.
Rewritten by urgent.news; may contain errors — check the original.
Source: dev.to