watchdog

Detect when parent process exits

为君一笑 提交于 2019-12-07 01:48:44
问题 I will have a parent process that is used to handle webserver restarts. It will signal the child to stop listening for new requests, the child will signal the parent that it has stopped listening, then the parent will signal the new child that it can start listening. In this way, we can accomplish less than 100ms down time for a restart of that level (I have a zero-downtime grandchild restart also, but that is not always enough of a restart). The service manager will kill the parent when it

Python watchdog for another Python process technique?

 ̄綄美尐妖づ 提交于 2019-12-06 14:43:44
问题 I have a realtime data grabber that runs indefinitely, grabbing data over HTTP and putting it in a MySQL database every few seconds. In my program, I have a while True loop that spawns workers (functions that download the data and save it) whenever the last spawned time is greater than X seconds: while True: if _last_updated - datetime.now() > timedelta(seconds=5): green_pool.spawn_n(worker) # yes I'm using Eventlet! _last_updated = datetime.now() What would be the best way to ensure that

面试官问我,Redis分布式锁如何续期?懵了。

坚强是说给别人听的谎言 提交于 2019-12-06 12:33:31
前言 上一篇[面试官问我,使用Dubbo有没有遇到一些坑?我笑了。]之后,又有一位粉丝和我说在面试过程中被虐了.鉴于这位粉丝是之前肥朝的 老粉丝 ,而且周一又要开启新一轮的面试,为了回馈他长期以来的支持,所以连夜写了本篇,希望能对他接下来的面试有所帮助. 真实案例 Redis分布式锁的正确姿势 据肥朝了解,很多同学在用分布式锁时,都是直接百度搜索找一个Redis分布式锁工具类就直接用了.关键是该工具类中还充斥着很多 System.out.println(); 等语句.其实Redis分布式锁比较正确的姿势是采用 redisson 这个客户端工具.具体介绍可以搜索最大的同性交友网站 github . 如何回答 首先如果你之前用Redis的分布式锁的姿势正确,并且看过相应的官方文档的话,这个问题 So easy .我们来看 坦白说,如果你英文棒棒哒那么看英文文档可能更好理解 By default lock watchdog timeout is 30 seconds and can be changed through Config.lockWatchdogTimeout setting. 但是你如果看的是中文文档 看门狗检查锁的超时时间默认是30秒 这句话肥朝从语文角度分析就是一个歧义句,他有两个意思 1.看门狗默认30秒去检查一次锁的超时时间 2.看门狗会去检查锁的超时时间

Why does this code deadlock?

╄→гoц情女王★ 提交于 2019-12-06 06:24:22
问题 I created 2 Linux kernel threads in my loadable module and I bind them to separate CPU cores running on a dual core Android device. After I run this few times, I noticed that the device reboots with a HW watchdog timer reset. I hit the issue consistently. What could be causing the deadlock? Basically, what i need to do is, make sure both the threads run do_something() at the same time on different cores without anybody stealing the cpu cycles(i.e. interrupts are disabled). I am using a

Crash reporting watchdog for when my application locks up on a customer's machine

拈花ヽ惹草 提交于 2019-12-05 19:45:25
I'm working with a somewhat unreliable (Qt/windows) application partly written for us by a third party (just trying to shift the blame there). Their latest version is more stable. Sort of. We're getting fewer reports of crashes, but we're getting lots of reports of it just hanging and never coming back. The circumstances are varied, and with the little information we can gather, we haven't been able to reproduce the problems. So ideally, I'd like to create some sort of watchdog which notices that the application has locked up, and offers to send a crash report back to us. Nice idea, but there

Monitoring a single file

笑着哭i 提交于 2019-12-05 07:26:43
I need to monitor (using watchdog ) a single file, not a whole directory. What is the best way to avoid monitoring a whole directory? I suppose this class watchdog.events.PatternMatchingEventHandler(patterns=None, ignore_patterns=None, ignore_directories=False, case_sensitive=False)[source] could be helpful, but how to define an appropriate pattern for my file ( C:/dir1/dir2/file.txt) ? If you want to watch a file path like C:/dict1/dict2/file.txt , I think that's your pattern right there. There are no wildcards in, so it should be usable as-is. As an aside, if Watchdog is giving you trouble,

Is BackgroundWorker's IsBusy same as “IsAlive”?

谁都会走 提交于 2019-12-05 04:51:55
I am trying to figure out a way to verify that a BackgroundWorker thread is alive (i.e. still running. The thread is essentially implemented as a simple infinite loop: while (AllConditionsMet()) { DoSomeMagic(); Thread.Sleep(10000); } The closest thing to IsAlive() I found so far is the IsBusy property, but given that my thread Sleep()s most of the time, I am not sure whether this will do the job. Can I count on IsBusy to do: if (!myWorker.IsBusy) RestartWorker(); or am I calling for trouble? Hans Passant BackgroundWorker.IsBusy is true as long as the DoWork event handler is busy and the

新浪微博:大规模离线视频处理系统的架构设计

自古美人都是妖i 提交于 2019-12-05 04:37:17
微博视频平台在4亿月活用户吃瓜嗨聊的高并发、大流量背景下,既要保证用户微博生产和消费体验,又要支持业务快速迭代,确保正确性、稳定性和高可用性。本次演将以微博视频大规模视频离线处理系统的架构设计为主题为大家带来大规模分布式系统的架构设计,性能优化和高可用保障等一线实战经验。 文 / 霍东海 整理 / LiveVideoStack 大家好,我是来自新浪微博视频平台和微博平台研发部的架构师霍东海,从2017年加入微博,目前在微博视频平台负责微博视频离线处理系统架构等相关工作,包括大规模离线微服务系统的架构设计和服务保障体系的建设等。近期专注于视频平台技术体系的提升对用户体验提升的帮助,主导构建了微博SVE(Streaming Video Engine)系统,支持大并发场景下对视频进行并行转码,大幅度提升转码效率。 1. 背景介绍 微博本身有大并发、大流量的特性,有4亿+的月活,同时微博也是一个开放平台,支持多种第三方分享,每天都会有百万视频分享需进行处理。 微博视频业务大概分两种业余形态,一个如左图所示,是竖版的短视频分享,另一个是如右图所示的稍微长一点的横向播放的短视频。 微博视频还有一些特殊的场景,例如在微博PC端点视频按钮会跳转到酷燃网,它是一个5到15分钟的短小综艺类视频分享的网站,如图中,下面都是一些优酷,爱奇艺,腾讯等视频网站分享到微博的视频。

Python watchdog for another Python process technique?

巧了我就是萌 提交于 2019-12-04 18:25:17
I have a realtime data grabber that runs indefinitely, grabbing data over HTTP and putting it in a MySQL database every few seconds. In my program, I have a while True loop that spawns workers (functions that download the data and save it) whenever the last spawned time is greater than X seconds: while True: if _last_updated - datetime.now() > timedelta(seconds=5): green_pool.spawn_n(worker) # yes I'm using Eventlet! _last_updated = datetime.now() What would be the best way to ensure that this module always does work, never freezes and is never down? Should I be checking the green pool size? I

Why does this code deadlock?

烈酒焚心 提交于 2019-12-04 14:38:59
I created 2 Linux kernel threads in my loadable module and I bind them to separate CPU cores running on a dual core Android device. After I run this few times, I noticed that the device reboots with a HW watchdog timer reset. I hit the issue consistently. What could be causing the deadlock? Basically, what i need to do is, make sure both the threads run do_something() at the same time on different cores without anybody stealing the cpu cycles(i.e. interrupts are disabled). I am using a spinlock and a volatile variable for this. I also have a semaphore for parent thread to wait on child thread.