Shashank
Shashank3mo ago

Actor running at negative profit margin, need cost breakdown guidance

I got an email today saying my Actor (shashankms2580/google-ads-transparency-scraper) is running at a negative profit margin (-91.6%). Revenue: $4.40 Cost: $8.43 Deficit: -$12.46 I want to understand why the costs are higher than the revenue even though I set PPE pricing (Run Start Fee, Lite Mode, Full Mode, etc.). Where exactly can I see the cost breakdown per run in the console? Could this be due to the way I priced my events vs how platform usage is calculated? Is there a way to adjust my event pricing so I don’t keep running into losses? Any guidance on how to analyze and optimize this would be really helpful! Thanks!
3 Replies
TimCoulter
TimCoulter3mo ago
I received that email, too, but it doesn't seem to be accurate, because my Insights page is showing that every individual day's usage is profitable. The only thing that might explain the losses is the first day after I published the actor, where I ran many test runs, using my own free account, for which there was obviously no actual billing. However, I also want to be sure that my PPE pricing pricing is set up correctly, so I am currently modifying the actor to log its billing and costs at end of every run.
ondro_k
ondro_k2mo ago
Hey, thank you for reporting this. The mail contains invalid data. Devs already know about it and they will look into it. The data in your actor's Insights page should contain the correct values.
so I am currently modifying the actor to log its billing and costs at end of every run.
@TimCoulter may I ask what costs are you logging? We internally break the actor costs into the following: - compute units - data transfer - dataset reads/writes - key value store reads/writes - request queue reads/writes - proxies Recently this helped us to reduce costs of one of our actors as we noticed the key value store costs increased by 200% in the previous 2 months - we were writing too often to the KVS Would you like to see a similar cost breakdown in the Insights page or did you have something else in mind?
TimCoulter
TimCoulter2mo ago
At the end of each run, my logging mechanism retrieves the current run costs and writes them (together with run PPE billing data) to a file in my developer KVS (not the user's KVS). This enables me to review detailed cost/revenue metrics for every run. As you said, it's possible to miscalculate running costs and either over-use resources or bill for them incorrectly, and I think detailed logging can go a long way to solving this (although I'm still experimenting with it, so time will tell). Here is an example of the log output:
"cost": {
"compute": {
"consumed": 0.06378,
"unit": 0.3,
"cost": 0.019
},
"residentialProxy": {
"consumed": 0.00138,
"unit": 8,
"cost": 0.011
},
"dataCenterProxy": {
"consumed": 0,
"unit": 1,
"cost": 0
},
"serpsProxy": {
"consumed": 0,
"unit": 2.5,
"cost": 0
},
"datasetReads": {
"consumed": 0,
"unit": 0.0004,
"cost": 0
},
"datasetWrites": {
"consumed": 7,
"unit": 0.005,
"cost": 0
},
"kevValueStoreReads": {
"consumed": 224,
"unit": 0.005,
"cost": 0.001
},
"kevValueStoreWrites": {
"consumed": 124,
"unit": 0.05,
"cost": 0.006
},
"kevValueStoreLists": {
"consumed": 37,
"unit": 0.05,
"cost": 0.002
},
"requestQueueReads": {
"consumed": 46,
"unit": 0.004,
"cost": 0
},
"requestQueueWrites": {
"consumed": 174,
"unit": 0.02,
"cost": 0.003
},
"externalTransfer": {
"consumed": 0.00041,
"unit": 0.2,
"cost": 0
},
"internalTransfer": {
"consumed": 0.00332,
"unit": 0.05,
"cost": 0
},
"total": 0.042
}
"cost": {
"compute": {
"consumed": 0.06378,
"unit": 0.3,
"cost": 0.019
},
"residentialProxy": {
"consumed": 0.00138,
"unit": 8,
"cost": 0.011
},
"dataCenterProxy": {
"consumed": 0,
"unit": 1,
"cost": 0
},
"serpsProxy": {
"consumed": 0,
"unit": 2.5,
"cost": 0
},
"datasetReads": {
"consumed": 0,
"unit": 0.0004,
"cost": 0
},
"datasetWrites": {
"consumed": 7,
"unit": 0.005,
"cost": 0
},
"kevValueStoreReads": {
"consumed": 224,
"unit": 0.005,
"cost": 0.001
},
"kevValueStoreWrites": {
"consumed": 124,
"unit": 0.05,
"cost": 0.006
},
"kevValueStoreLists": {
"consumed": 37,
"unit": 0.05,
"cost": 0.002
},
"requestQueueReads": {
"consumed": 46,
"unit": 0.004,
"cost": 0
},
"requestQueueWrites": {
"consumed": 174,
"unit": 0.02,
"cost": 0.003
},
"externalTransfer": {
"consumed": 0.00041,
"unit": 0.2,
"cost": 0
},
"internalTransfer": {
"consumed": 0.00332,
"unit": 0.05,
"cost": 0
},
"total": 0.042
}

Did you find this page helpful?