Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overpriced node indexing #2

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 15 additions & 19 deletions components/ProviderList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -237,16 +237,14 @@ export const ProviderList = ({ endpoint, initialData, enableShowingOfflineNodes
Total Earnings
</th>
<th scope="col" className="px-6 py-5 text-left text-xs font-medium text-white uppercase tracking-wider">
CPU/h
</th>
<th scope="col" className="px-6 py-5 text-left text-xs font-medium text-white uppercase tracking-wider">
Env/h
Monthly cost USD
</th>

<th
scope="col"
className="px-6 py-5 text-left text-xs font-medium text-white uppercase tracking-wider rounded-r-lg whitespace-nowrap"
>
Start price
Monthly cost GLM
</th>
</tr>
</thead>
Expand Down Expand Up @@ -314,6 +312,15 @@ export const ProviderList = ({ endpoint, initialData, enableShowingOfflineNodes
<span className="px-2 ml-1 inline-flex text-xs leading-5 font-semibold rounded-full golembadge bg-golemblue text-white golemtext">
v{provider.version}
</span>
{provider.runtimes.vm?.is_overpriced ? (
<span className="px-2 ml-1 inline-flex text-xs leading-5 font-semibold rounded-full golembadge bg-red-500 text-white golemtext">
Overpriced
</span>
) : provider.runtimes.vm?.cheaper_than ? (
<span className="px-2 ml-1 inline-flex text-xs leading-5 font-semibold rounded-full golembadge bg-green-500 text-white golemtext">
Great Price
</span>
) : null}
</div>
</div>
</td>
Expand Down Expand Up @@ -358,24 +365,13 @@ export const ProviderList = ({ endpoint, initialData, enableShowingOfflineNodes
</td>
<td className="px-6 py-4 whitespace-nowrap text-sm font-medium">
<a className="font-semibold text-gray-900 text-sm golemtext dark:text-gray-300">
{priceHashMapOrDefault(provider, "golem.usage.cpu_sec")}{" "}
<span className="text-golemblue golemgradient dark:text-gray-400">GLM</span>
{RoundingFunction(provider.runtimes.vm?.monthly_price_usd)}{" "}
<span className="text-golemblue golemgradient dark:text-gray-400">$</span>
</a>
</td>
<td className="px-6 py-4 whitespace-nowrap text-sm font-medium">
<a className="font-semibold text-gray-900 text-sm golemtext dark:text-gray-300">
{priceHashMapOrDefault(provider, "golem.usage.duration_sec")}{" "}
<span className="text-golemblue golemgradient dark:text-gray-400">GLM</span>
</a>
</td>
<td className="px-6 py-4 whitespace-nowrap text-sm font-medium rounded-r-lg">
<a className="font-semibold text-gray-900 text-sm golemtext dark:text-gray-300">
{
(
provider.runtimes.vm?.properties["golem.com.pricing.model.linear.coeffs"] ||
provider.runtimes.wasmtime.properties["golem.com.pricing.model.linear.coeffs"]
).slice(-1)[0]
}{" "}
{RoundingFunction(provider.runtimes.vm?.monthly_price_glm)}{" "}
<span className="text-golemblue golemgradient dark:text-gray-400">GLM</span>
</a>
</td>
Expand Down
41 changes: 41 additions & 0 deletions pages/network/provider/[node_id].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ export const ProviderDetailed = ({ initialData, initialIncome }: { initialData:
v{nodeData[0].version}
</span>
</div>

<div>
{nodeData[0].computing_now ? (
<span className="px-2 ml-1 inline-flex text-xs leading-5 font-semibold rounded-full bg-yellow-500 text-white">
Expand All @@ -142,6 +143,19 @@ export const ProviderDetailed = ({ initialData, initialIncome }: { initialData:
</span>
)}
</div>
{nodeData[0].runtimes.vm?.is_overpriced ? (
<div>
<span className="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-red-500 text-white">
Overpriced
</span>
</div>
) : nodeData[0].runtimes.vm?.cheaper_than ? (
<div>
<span className="px-2 inline-flex text-xs leading-5 font-semibold rounded-full bg-green-500 text-white">
Great Price
</span>
</div>
) : null}
</div>
</div>

Expand All @@ -151,6 +165,33 @@ export const ProviderDetailed = ({ initialData, initialIncome }: { initialData:
{nodeData[0].runtimes.vm?.properties["golem.inf.cpu.brand"]}
</p>
) : null}
{nodeData[0].runtimes.vm?.is_overpriced ? (
<p className="text-sm font-medium truncate text-gray-500 mt-2 ">
Comparing this node against an AWS {nodeData[0].runtimes.vm?.overpriced_compared_to.name} instance with{" "}
{nodeData[0].runtimes.vm?.overpriced_compared_to.vcpu} cores and{" "}
{nodeData[0].runtimes.vm?.overpriced_compared_to.memory} GB memory shows that
<br></br>
this provider is most likely overpriced. We suggest configuring a pricing setting of: CPU/h 0 GLM, Env/h{" "}
{nodeData[0].runtimes.vm?.suggest_env_per_hour_price} GLM, Start 0 GLM. <br></br>which equals the
Monthly USD price (${nodeData[0].runtimes.vm?.overpriced_compared_to.price_usd * 730}) of the{" "}
{nodeData[0].runtimes.vm?.overpriced_compared_to.name} instance
<br></br>
<br></br>This nodes monthly USD cost is ${nodeData[0].runtimes.vm?.monthly_price_usd} which is roughly{" "}
{RoundingFunction(nodeData[0].runtimes.vm?.times_more_expensive)} times more expensive compared to AWS
</p>
) : nodeData[0].runtimes.vm?.cheaper_than ? (
<p className="text-sm font-medium truncate text-green-500 mt-2">
Comparing this node against an AWS {nodeData[0].runtimes.vm?.cheaper_than.name} instance with{" "}
{nodeData[0].runtimes.vm?.cheaper_than.vcpu} cores and {nodeData[0].runtimes.vm?.cheaper_than.memory} GB
memory shows that
<br></br>
this provider is more cost-effective. The Monthly USD price of the AWS{" "}
{nodeData[0].runtimes.vm?.cheaper_than.name} instance is $(
{nodeData[0].runtimes.vm?.cheaper_than.price_usd * 730}).<br></br>
<br></br>This node's monthly USD cost is ${nodeData[0].runtimes.vm?.monthly_price_usd}, which is roughly{" "}
{RoundingFunction(nodeData[0].runtimes.vm?.times_cheaper)} times cheaper compared to AWS.
</p>
) : null}
</div>

<div className="mt-6 flex flex-col-reverse justify-stretch space-y-4 space-y-reverse sm:flex-row-reverse sm:justify-end sm:space-x-reverse sm:space-y-0 sm:space-x-3 md:mt-0 md:flex-row md:space-x-3">
Expand Down