doue2666 2016-03-08 14:33
浏览 50
已采纳

服务器端应用程序 - 最佳实践?

I am not sure what the best practice is about coding server-side sometimes.

Lets say we have a rank tracker application which updates the domain google ranking for specific keywords. We create an application (e.g. Laravel Framework) which includes frontend and backend. Then we have to update the rankings for all websites from time to time. I know that a cronjob would help me to execute a script every few minutes.

But if it gets more complicated like the Uber Driving system... cronjobs will not be enough right? We need some server-side application written in C#, Java, ... which are continuously checking for tasks. right?

I just need some advice. Maybe someone could also point out in which case cronjobs are not enough and we have to use own applications (C#, Java,..) to make sure everything is working fine.

  • 写回答

1条回答 默认 最新

  • dongpouda6700 2016-03-08 14:47
    关注

    First you need to take a look at what Cron Jobs are used for: https://en.wikipedia.org/wiki/Cron

    The software utility Cron is a time-based job scheduler

    So in cases where you want to execute/task things at specific times, then a Cron Job would satisfy that need.

    If however you want to continuously check for a condition, and relay that information to-and-fro client and server, Sockets are generally what you're looking at. Specifically web sockets (in web based applications, also again depends on where/how you want to use it).

    https://en.wikipedia.org/wiki/WebSocket https://en.wikipedia.org/wiki/Computer_network_programming

    "Continuously" disregards the current time (I.e.: It's not the same as running every second, or even millisecond).

    Language also doesn't matter, but preferably you'd want to use something that has decent socket support / well documented libraries available.

    TLDR;

    Cron Jobs are good for when you want to do things at very specific times, like database backups. Where as sockets are more widely used to relay live information.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 #MATLAB仿真#车辆换道路径规划
  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
  • ¥15 数据可视化Python
  • ¥15 要给毕业设计添加扫码登录的功能!!有偿
  • ¥15 kafka 分区副本增加会导致消息丢失或者不可用吗?
  • ¥15 微信公众号自制会员卡没有收款渠道啊
  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘