低端持久性策略? [英] low-end persistence strategies?

查看:86
本文介绍了低端持久性策略?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在中等到高价的服务器应用程序中使用对象持久性之前启动了一些线程。这个是关于低端应用程序,例如,个人网站上的一个简单的cgi,每天可能会有十几个点击。

这个想法就是你想要的保留一些数据,即

cgi可以更新。


立即,使用MySQL数据库的典型策略变得太多了

很痛苦。任何类型的编译和安装的第三方模块(例如,
Metakit)也是一个太大的痛苦。但是仍然需要某种并发策略,即使它像原始文件那样锁定b / b
,否则两个人同时运行cgi可以擦除

输出数据存储。但你不想让应用程序崩溃,如果你可以帮助它就会留下一个

锁定。


无论如何,像dbm或shelve这样的东西加上flock风格的文件

锁定和dbmopen的一个版本,如果文件被锁定,它会在1 / b
秒后自动重试,可以很好地完成工作,加上可以

是一个用于检测陈旧锁定的清理机制。


是否有类似的标准方法,或者我应该只是将
编码为显而易见的方式?


谢谢。

解决方案

周二,2005年2月15日18:57:47 - 0800 schrieb Paul Rubin:

我已经在中等到高端服务器应用程序中的对象持久性之前开始了一些线程。这个是关于低端应用程序,例如,个人网站上的简单cgi,每天可能会有十几个点击。
想法是你只想保留一些数据那个
cgi可以更新。
[cut]无论如何,像dbm或shelve这样的东西加上flock风格的文件锁定和dbmopen的一个版本,如果文件被锁定,它会在1 /秒后自动重试,这样可以很好地完成工作,还有可能是一个用于检测陈旧锁定的清理机制。

是否有类似的标准方法,或者我应该以明显的方式对其进行编码? / blockquote>





我会使用pickle模块并访问

pickle文件序列化(一个接一个地允许读取或写入
)文件锁定。


这意味着你的cgi应用程序只能提供一个请求

接着另一个。


HTH,

Thomas


-

ThomasGüttler, http://www.thomas-guettler.de/




也许ZODB有帮助。

-

问候,


Diez B. Roggisch


" Diez B. Roggisch" <德********* @ web.de>写道:

也许ZODB有帮助。




我认为这对我想象的来说太重了,但我

尚未使用它。我不太关心对象持久性

(只是保存字符串就足够了),而不是找到最简单的处理并发更新尝试的方法。


I''ve started a few threads before on object persistence in medium to
high end server apps. This one is about low end apps, for example, a
simple cgi on a personal web site that might get a dozen hits a day.
The idea is you just want to keep a few pieces of data around that the
cgi can update.

Immediately, typical strategies like using a MySQL database become too
big a pain. Any kind of compiled and installed 3rd party module (e.g.
Metakit) is also too big a pain. But there still has to be some kind
of concurrency strategy, even if it''s something like crude file
locking, or else two people running the cgi simultaneously can wipe
out the data store. But you don''t want crashing the app to leave a
lock around if you can help it.

Anyway, something like dbm or shelve coupled with flock-style file
locking and a version of dbmopen that automatically retries after 1
second if the file is locked would do the job nicely, plus there could
be a cleanup mechanism for detecting stale locks.

Is there a standard approach to something like that, or should I just
code it the obvious way?

Thanks.

解决方案

Am Tue, 15 Feb 2005 18:57:47 -0800 schrieb Paul Rubin:

I''ve started a few threads before on object persistence in medium to
high end server apps. This one is about low end apps, for example, a
simple cgi on a personal web site that might get a dozen hits a day.
The idea is you just want to keep a few pieces of data around that the
cgi can update. [cut] Anyway, something like dbm or shelve coupled with flock-style file
locking and a version of dbmopen that automatically retries after 1
second if the file is locked would do the job nicely, plus there could
be a cleanup mechanism for detecting stale locks.

Is there a standard approach to something like that, or should I just
code it the obvious way?



Hi,

I would use the pickle module and access to the
pickle files could be serialized (one after the other
is allowed to read or write) with file locking.

This means your cgi application can only serve one request
after the other.

HTH,
Thomas

--
Thomas Güttler, http://www.thomas-guettler.de/



Maybe ZODB helps.
--
Regards,

Diez B. Roggisch


"Diez B. Roggisch" <de*********@web.de> writes:

Maybe ZODB helps.



I think it''s way too heavyweight for what I''m envisioning, but I
haven''t used it yet. I''m less concerned about object persistence
(just saving strings is good enough) than finding the simplest
possible approach to dealing with concurrent update attempts.


这篇关于低端持久性策略?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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