使用Azure函数连续进行数据库同步 [英] continuous database sync with azure functions

查看:88
本文介绍了使用Azure函数连续进行数据库同步的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用xamarin和azure 无服务器功能作为该应用程序的后端开发应用程序. 我将通过云上的数据库实时同步用户的地图坐标.即:从所有用户获取坐标,然后同时连续将更新后的坐标同时推送给所有用户,以便所有用户都能看到彼此的实时位置.

I am developng an app with xamarin and azure serverless functions as backend for the app. I will be syncing map coordinates from the users in real time with a database on the cloud. i.e : taking coordinates from all users and then pushing the updated coordinates to all users at the same time, continuously so that all users can see live location of each other.

因此,我必须在连续循环中调用 azure函数,以便将数据库与云同步.因此它可以每隔4-5秒检查一次db.这是最好的方法吗?还是这会导致过多执行天蓝色函数并可能代价高昂?如果有更好的方法来同步数据库,请提出建议.谢谢.

So I have to call an azure function in continous loop in order to sync database with cloud. so it can check db after every, 4-5 secs. is it the best way to do this? or will this cause too much execution of azure function and might be costly? If there is a better way to sync the db please suggest. Thankyou.

推荐答案

您有一个移动应用程序正在对天蓝色函数进行http调用.功能是有弹性的,规模可能会很好.据我了解,您不是在 询问如何实现此服务的服务器端;而是真正的问题是价格,对不对?

You have a mobile app that is making http calls to azure functions. Functions is elastic and scale will likely be fine. As I understand, you're not asking how to implement the server side of this; rather the real question here is pricing, right?

Azure函数可以通过两种方式运行:

Azure Functions can run in two ways:

  1. 无服务器",又称消费计划".在这种情况下,Azure Functions正在管理基础服务器(并向外扩展),并且您只需为活跃使用付费(每GB *秒).这是您访问 http://functions.Azure.com 时的默认设置.在此处查看定价详细信息: https://azure.microsoft.com/zh-我们/定价/详细信息/功能/
  2. "AppService"-在这种情况下,您已经购买了虚拟机,并决定了扩展规模. 您每月支付固定费用.在此处查看定价详细信息: https://azure.microsoft.com/zh-cn/pricing/details/app-service/
  1. "serverless", aka "Consumption plan". In this case, Azure Functions is managing the underlying server (and scale out) and you pay only for active usage (per GB*Sec). This is what you get by default when you visit http://functions.Azure.com. See pricing details here: https://azure.microsoft.com/en-us/pricing/details/functions/
  2. "AppService" - In this case, you've bought a VM upfront and you decided how much to scale. You pay a fixed monthly cost. See pricing details here: https://azure.microsoft.com/en-us/pricing/details/app-service/

您可以在它们之间切换.我建议从第一种方法开始.当您的流量较低时,它一开始肯定会比较便宜.监控成本,在定价表中运行方案,如果最终更便宜,可以考虑切换到第二方案.

You can switch between them. I'd recommend starting with the first approach. It will certainly be cheaper in the beginning when you have low traffic. Monitor cost, run your scenarios through the pricing sheets, and consider switching to the 2nd if it ends up being cheaper.

这篇关于使用Azure函数连续进行数据库同步的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆