草庐IT

python - 我的基于 Web 的系统需要一个消息/队列解决方案

coder 2023-10-18 原文

我正在为我在 Ubuntu 上运行的基于 Web 的系统寻找消息/队列解决方案。

该系统基于以下技术构建:

  • Javascript (Extjs framework) - Frontend
  • PHP
  • Python (Daemon service which interacts with the encryption device)
  • Python pyserial - (Serial port interactions)
  • MySQL
  • Linux - Ccustom bash scripts(to update DB/mail reports)

该系统有以下用途:

  • Capture client information on a distributed platform
  • Encrypt/decrypt sensitive transactions using a Hardware device

系统故障:

  1. The user gains access to the system using a web browser
  2. The user captures client information and on pressing "submit" button The data is sent to the encryption device and the system enters a wait state
  3. The data is then encrypted on the device and sent back to the browser
  4. The encrypted data is saved to the DB
  5. System exits wait state and displays DONE message

请注意:我已经处理了等待/进度消息,所以让我们忽略它。

到目前为止我做了什么:

  • I created a python daemon which monitors a DB view for any new requests
  • The daemon service executes new requests on the device using pyserial and updates the requests table with a "response" ie. the encrypted content
  • I created a polling service in PHP which frequently checks if there is a "response" in >the requests table for the specific request
  • Created the Extjs frontend with appropriate wait/done status messages

当前设置的问题:

  • Concurreny - We expect > 20 users at any time submitting encryption/decryption requests using a database as a message/queuing solution is not scalable due to table locking and only 1 listening process which monitors for requests
  • Daemon service - Relying on a daemon service is a bit risky and the DB overhead seems a bit high polling the view for new requests every second
  • Development - It would simplify my development tasks by just sending requests to a encrypt/decrypt service instead of doing this whole process of inserting a request in the db,polling for the response and processing the request in the daemon service.

我的问题:

What would be the ideal message/queening solution in this situation? Please take into >account my system exclusively runs on a Ubuntu O/S.

我已经完成了一些 Google 服务并遇到了一个叫做“Stomp”服务器的东西,但事实证明它设置起来有些困难并且缺少一些文档。此外,我更喜欢那些在设置类似东西方面有经验的人的建议,而不是一些“如何”指南:)

感谢您的宝贵时间

最佳答案

相信流行RabbitMQ实现AMQP提供 PHP 扩展(here),您绝对可以在 Python 中访问 AMQP,例如通过Qpid . RabbitMQ 也很容易安装在 Ubuntu(或 Debian)上,参见例如here .

无论是通过 RabbitMQ 还是其他方式,与更“封闭”的解决方案相比,采用开放的消息传递和队列协议(protocol)(如 AMQP)具有明显和明确的优势(即使在技术上是开源的,此类解决方案也不会提供那么多的实现,因此具有灵 active ,作为一种广泛采用的开放式标准协议(protocol))。

关于python - 我的基于 Web 的系统需要一个消息/队列解决方案,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3435954/

有关python - 我的基于 Web 的系统需要一个消息/队列解决方案的更多相关文章

  1. python - 如何使用 Ruby 或 Python 创建一系列高音调和低音调的蜂鸣声? - 2

    关闭。这个问题是opinion-based.它目前不接受答案。想要改进这个问题?更新问题,以便editingthispost可以用事实和引用来回答它.关闭4年前。Improvethisquestion我想在固定时间创建一系列低音和高音调的哔哔声。例如:在150毫秒时发出高音调的蜂鸣声在151毫秒时发出低音调的蜂鸣声200毫秒时发出低音调的蜂鸣声250毫秒的高音调蜂鸣声有没有办法在Ruby或Python中做到这一点?我真的不在乎输出编码是什么(.wav、.mp3、.ogg等等),但我确实想创建一个输出文件。

  2. ruby - 我需要将 Bundler 本身添加到 Gemfile 中吗? - 2

    当我使用Bundler时,是否需要在我的Gemfile中将其列为依赖项?毕竟,我的代码中有些地方需要它。例如,当我进行Bundler设置时:require"bundler/setup" 最佳答案 没有。您可以尝试,但首先您必须用鞋带将自己抬离地面。 关于ruby-我需要将Bundler本身添加到Gemfile中吗?,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.com/questions/4758609/

  3. ruby - 使用 Vim Rails,您可以创建一个新的迁移文件并一次性打开它吗? - 2

    使用带有Rails插件的vim,您可以创建一个迁移文件,然后一次性打开该文件吗?textmate也可以这样吗? 最佳答案 你可以使用rails.vim然后做类似的事情::Rgeneratemigratonadd_foo_to_bar插件将打开迁移生成的文件,这正是您想要的。我不能代表textmate。 关于ruby-使用VimRails,您可以创建一个新的迁移文件并一次性打开它吗?,我们在StackOverflow上找到一个类似的问题: https://sta

  4. ruby-on-rails - Rails - 一个 View 中的多个模型 - 2

    我需要从一个View访问多个模型。以前,我的links_controller仅用于提供以不同方式排序的链接资源。现在我想包括一个部分(我假设)显示按分数排序的顶级用户(@users=User.all.sort_by(&:score))我知道我可以将此代码插入每个链接操作并从View访问它,但这似乎不是“ruby方式”,我将需要在不久的将来访问更多模型。这可能会变得很脏,是否有针对这种情况的任何技术?注意事项:我认为我的应用程序正朝着单一格式和动态页面内容的方向发展,本质上是一个典型的网络应用程序。我知道before_filter但考虑到我希望应用程序进入的方向,这似乎很麻烦。最终从任何

  5. ruby-on-rails - 渲染另一个 Controller 的 View - 2

    我想要做的是有2个不同的Controller,client和test_client。客户端Controller已经构建,我想创建一个test_clientController,我可以使用它来玩弄客户端的UI并根据需要进行调整。我主要是想绕过我在客户端中内置的验证及其对加载数据的管理Controller的依赖。所以我希望test_clientController加载示例数据集,然后呈现客户端Controller的索引View,以便我可以调整客户端UI。就是这样。我在test_clients索引方法中试过这个:classTestClientdefindexrender:template=>

  6. ruby - 在 jRuby 中使用 'fork' 生成进程的替代方案? - 2

    在MRIRuby中我可以这样做:deftransferinternal_server=self.init_serverpid=forkdointernal_server.runend#Maketheserverprocessrunindependently.Process.detach(pid)internal_client=self.init_client#Dootherstuffwithconnectingtointernal_server...internal_client.post('somedata')ensure#KillserverProcess.kill('KILL',

  7. ruby - rspec 需要 .rspec 文件中的 spec_helper - 2

    我注意到像bundler这样的项目在每个specfile中执行requirespec_helper我还注意到rspec使用选项--require,它允许您在引导rspec时要求一个文件。您还可以将其添加到.rspec文件中,因此只要您运行不带参数的rspec就会添加它。使用上述方法有什么缺点可以解释为什么像bundler这样的项目选择在每个规范文件中都需要spec_helper吗? 最佳答案 我不在Bundler上工作,所以我不能直接谈论他们的做法。并非所有项目都checkin.rspec文件。原因是这个文件,通常按照当前的惯例,只

  8. ruby-on-rails - 如果 Object::try 被发送到一个 nil 对象,为什么它会起作用? - 2

    如果您尝试在Ruby中的nil对象上调用方法,则会出现NoMethodError异常并显示消息:"undefinedmethod‘...’fornil:NilClass"然而,有一个tryRails中的方法,如果它被发送到一个nil对象,它只返回nil:require'rubygems'require'active_support/all'nil.try(:nonexisting_method)#noNoMethodErrorexceptionanymore那么try如何在内部工作以防止该异常? 最佳答案 像Ruby中的所有其他对象

  9. ruby - 如何在 Lion 上安装 Xcode 4.6,需要用 RVM 升级 ruby - 2

    我实际上是在尝试使用RVM在我的OSX10.7.5上更新ruby,并在输入以下命令后:rvminstallruby我得到了以下回复:Searchingforbinaryrubies,thismighttakesometime.Checkingrequirementsforosx.Installingrequirementsforosx.Updatingsystem.......Errorrunning'requirements_osx_brew_update_systemruby-2.0.0-p247',pleaseread/Users/username/.rvm/log/138121

  10. ruby - 为什么 SecureRandom.uuid 创建一个唯一的字符串? - 2

    关闭。这个问题需要detailsorclarity.它目前不接受答案。想改进这个问题吗?通过editingthispost添加细节并澄清问题.关闭8年前。Improvethisquestion为什么SecureRandom.uuid创建一个唯一的字符串?SecureRandom.uuid#=>"35cb4e30-54e1-49f9-b5ce-4134799eb2c0"SecureRandom.uuid方法创建的字符串从不重复?

随机推荐