带有 MySQL 数据库的 PHP Yii 框架上的应用程序能否处理 2 万名员工的 ERP 解决方案?

发布于 2024-11-09 03:19:50 字数 350 浏览 0 评论 0原文

我们有一个为孟加拉国最大的服装行业之一建立 ERP 系统的项目。

他们有大约 20,000 名员工,每个月大约有 10% 的员工进出。我们是一家拥有 5 名 PHP 开发人员的小公司,对如此大的项目没有太多经验。我们之前使用 Codeigniter/Zend Framework 和 MySQL 数据库开发了不同的中小型项目。

对于这个项目,我们决定使用 Yii 框架和 MySQL 或 PostgreSQL。每天大约会有100万条数据库查询。现在我的问题是 MySQL/PostgreSQL 可以处理这个负载还是有更好的替代方案?使用 Yii 框架可以吗?或者对于这种应用程序有更好的 PHP 框架吗?我们只有 5 个月的时间来构建工资和员工管理模块。

We have got a project to build an ERP system for one of the largest garment industry of Bangladesh.

They have around 20,000 employees and about 10% of them get out/in every month. We are a small company with 5 PHP developers and don't have much experience with such a large project. We have developed different small/medium scale projects previously with Codeigniter/Zend Framework and MySQL database.

For this project we decided to go with Yii framework and MySQL or PostgreSQL. There will be about 1 million database query every day. Now my question is can MySQL/PostgreSQL handle this load or is there a better alternative? Is it ok to do it with Yii framework or there have a better PHP framework for this kind of application? We have got only 5 months to build the payroll and employee management modules.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

一曲爱恨情仇 2024-11-16 03:19:50

一方面,考虑使用 PostgreSQL 而不是 MySQL。您将处理关键任务数据,一般来说,您会欣赏到:

  • 您将可以访问窗口函数(对报告有用)、语句以及更强大的查询规划器。
  • 您将拥有额外的数据类型,即几何类型,可用于优化与日期范围重叠相关的查询。
  • 您将可以访问全文搜索功能,而无需使用容易导致数据损坏的引擎 (MyISAM)。
  • 您将有更多选项来实现数据库复制(其中一些是内置的)。

关于可扩展性,请注意可扩展性!=性能。后者是为了让个人请求更快;前者是为了能够处理大量的并发请求,并且通常会对后者造成轻微的影响。

对于 PHP 框架,我个人从未使用过 Yii,所以我不知道它的扩展性如何。但我非常确定 Symfony2 (或 Symfony,如果您不喜欢使用测试版软件)将会很好地扩展:其主要开发人员在一家网络机构工作,该机构的主要客户是大中型组织。

For one thing, consider using PostgreSQL rather than MySQL. You're going to be dealing with mission-critical data and, in general, you'll appreciate that:

  • You will have access to window functions (useful for reports), with statements, and a much more robust query planner.
  • You will have extra data types, namely geometry types which can be used to optimize date-range overlap related queries.
  • You will have access to full text search functionality without needing to use an engine (MyISAM) which is prone to data corruption.
  • You will have more options to implement DB replication (some of which are built-in).

With respect to scalability, be wary that scalability != performance. The latter is about making individual requests faster; the former is about being able to handle massive quantities of simultaneous requests, and often comes with a slight hit to the latter.

For the PHP framework, I've never used Yii personally, so I do not know how well it scales. But I'm quite certain that Symfony2 (or Symfony, if you're not into using beta software) will scale nicely: its key devs work in a web-agency whose main customers are mid- to large-sized organizations.

喵星人汪星人 2024-11-16 03:19:50

我认为,Yii 可以很好地处理(相对)大量的数据。我使用 Yii 在小型虚拟主机上管理 130 万条记录、每天更新一些 thausend 以及每天几千个查询,性能令人惊叹。

如果你的数据库可以处理这些数据,你的 Yii 应用程序也可以处理它。

您对数据库的选择将是一个重要点。所以@Denis 说了一些重要的想法。通过使用 MySQL,您可能必须探索/确定适合您需求的存储引擎。

但是,有一些要点是我通过使用 Yii 创建一个不断发展的项目而意识到的。你应该考虑这些事情:

-Yii 是一个年轻的框架:支持新技术(如 ajax),但在某些特殊情况下它有点不成熟:很容易在几个小时内生成一个基本的应用程序。特殊情况和要求可能会出现问题。
例如:他们有一个很好的用户输入验证机制(HTML 表单)。但在 Yii 1.1.6 之前,它不支持 HTML 复选框,从 Yii 1.1.7 开始,默认支持复选框,但不支持复选框组。另一个问题:Yii 总是使用表别名,它总是“t”。这可能是个问题!有时您可以定义该别名,有时则不能(这是不一致的)。如果你想在 MySql 中锁定几个表,你就会遇到问题,因为 Yii 使用相同的别名“t”来调用每个表。因此,您无法通过表名来掠夺 MySql 中的表,也无法锁定由相同别名调用的几个表。 ->这些是具体问题,您可以通过编写纯 PHP(不使用 Yii 功能)来解决它们。我想说的是:该框架在非常情况下不会有帮助,但在大多数情况下。

-Yii 易于扩展。添加自己的扩展或功能很容易。因此,许多“小问题”可以通过编写自己的扩展、小部件或通过重写方法来解决。

-Yii 支持 PHP 5.2。 Yii 与 5.3 兼容,但是(Yii 在 5.3 上运行 - 从昨天起我仍在使用它,它可以工作)但不支持 5.3 的新功能(也许您需要一个?)
PHP5.3 将(也许)得到 Yii 2.0 的支持 - 在遥远的未来(2012 年)

- Yii 有一个小型(但非常好的)社区。

-没有专业支持(你可以发布错误,希望任何人都会修复它 - 或者你自己修复它)

-Yii 是 OO PHP。通过处理数据对象来考虑这一点。可以将大量数据加载到数据对象中。但请记住,您的应用程序服务器有足够的 RAM(但这不是 Yii 特有的东西

)结束。

I think, Yii will work fine with (relatively) large amount of data. I'm using Yii to manage 1.3 million records, some thausend updates a day and some thousand querys a day on an small virtual host with an amazing performance.

If your database can handle this data, your Yii application will also handle that.

Your choice of the database will be an important point. So @Denis said some important thinks. By using MySQL probably you have to explore / determined the right storage-engine for your needs.

But, there are some points, which i realized by creating an growing project with Yii. You should think about those things:

-Yii is an young framework: new technologies (like ajax) are supported, but in some special cases it's a bit immature: it's very easy to generate an basic application in a cuple of hours. Problem could be occur by special situation and requirements.
Example: they have an nice validation-mechanism for user inputs(HTML Forms). But until Yii 1.1.6 that doesn't work with HTML Checkboxes, since Yii 1.1.7, Checkboxes are supported by default, but no groups of checkboxes. An other problem: Yii alway uses an table alias, which is always "t". That could be a problem! Sometimes you can define that alias, sometimes not (which is inconsistent). If you like to lock a couple of tables in MySql, you ran into a problem, because Yii calls every table with the same alias "t". So you are unable to loot the tables in MySql by tablename and it's also impossible to lock a couple of tables, which called by the same alias. -> those are specific problems, you can solve them, by writing pure PHP (not using Yii functionality) What I'm trying to say: the framework will not be helpful in very case, but in mostly.

-Yii is easy to extend. It's easy to add own extensions or functionality. So lot's of those "small problems" can be solved be writing own extensions, widgets or by overriding methods.

-Yii supports PHP 5.2. Yii is compatible with 5.3 but (Yii runs on 5.3 - i'm still using it since yesterday, it work's) but doesn't support new features from 5.3 (maybe you need one?)
PHP5.3 will be (maybe) supported with Yii 2.0 - in a distance future (2012)

-Yii has a small (but very good) community.

-there is no professional support (you can post bugs in hope, anybody will fix it - or you will fix it yourself)

-Yii is OO PHP. Think about that by handling with Data-Objects. It's possible to load large amount of data into Data-objects. But keep in mind, that your application server have enough RAM (but that's not a Yii specific thing)

At all: i like Yii an if your application is not to complex, you will have a lot of fun an an nice and powerful application at the end.

昔梦 2024-11-16 03:19:50

不过,我认为您可能问错了问题。

您有五个月的时间来构建 ERP 系统。主要关注点应该是:

  • 安全。您正在处理金钱和个人信息。
  • 可靠性。正常运行时间可能是一个大问题(至少在工作时间)
  • 一致性。您不想冒丢失数据或降低数据
  • 开发人员生产力的风险。五个月的时间并没有太多时间来构建您所描述的
  • 可维护性。听起来这是一项核心企业资产,使用寿命长达数年——未来可能需要维护和扩展。
  • 可扩展性。您需要支持数以万计的员工,每个员工都有很多考勤卡、工资表等
  • 绩效。您希望应用程序具有响应能力。

我会质疑性能是否是绝对优先考虑的——它不应该很慢,但许多 ERP 系统有点迟缓。性能优化通常意味着权衡其他优先级 - 例如,ORM 系统提高了开发人员的工作效率,但可能比手工编写的 SQL 慢。

至于可扩展性——只要你有一个合理设计的模式,我认为 20K 员工对于任何像样的硬件上的现代 RDBMS 来说都不是太大的挑战。

所以,如果我是你,我可能会选择 PostgreSQL,原因是 Denis 提到的。没用过 Yii,但看起来完全合理。我会使用 ORM,直到你发现性能确实无法接受的情况。

重要的是,我会构建一个测试框架,允许您在开发周期中监控性能和可扩展性(我为此使用 JMeter),并且仅在确实需要时才进行性能优化。在你知道有问题之前,以性能的名义牺牲所有其他东西——尤其是生产力和可维护性——往往会创建过于复杂的解决方案,而它们反过来又往往会带来更多的安全问题和维护挑战。

I think you might be asking the wrong question, though.

You have five months to build an ERP system. The primary concerns should be:

  • security. You're dealing with money and personal details.
  • reliability. Uptime is probably a big deal (at least during working hours)
  • consistency. You don't want to risk losing data or corrupting data
  • developer productivity. Five months is not much time do build what you describe
  • maintainability. Sounds like this is a core enterprise asset, with a lifetime of years - it's likely to require maintenance and extension in the future.
  • scalability. You need to support tens of thousands of workers, each with many time cards, pay roll runs etc.
  • performance. You want the application to be responsive.

I would query whether performance is an absolute priority - it shouldn't be slow, but many ERP systems are a bit sluggish. Performance optimizations often mean trading off other priorities - for instance, an ORM system improves developer productivity, but can be slower than hand-crafted SQL.

As for scalability - as long as you have a reasonably designed schema, I don't think 20K employees is much of a challenge to any modern RDBMS on decent hardware.

So, if I were you, I'd probably go with PostgreSQL, for the reasons Denis mentions. Never used Yii, but it seems perfectly reasonable. I would use ORM until you find a situation where the performance really is unacceptable.

Critically, I would put together a testing framework which allows you to monitor performance and scalability during the development cycle (I use JMeter for this), and only make performance optimizations if you really have to. Sacrificing all the other things - especially productivity and maintainability - in the name of performance before you know you have a problem tends to create over-complex solutions, and they in turn tend to have more security issues and maintenance challenges.

粉红×色少女 2024-11-16 03:19:50

只是补充一下,
Yii 在两个方向上都可以很好地扩展(即使用新模块等添加功能,并且在性能方面是最快的 php 框架之一)。
我认为 Yii 的唯一缺点是它的用户群较少,因此支持比其他一些框架要少一些,但这种情况正在迅速改变。
Yii 最好的部分是基于 gii 的代码生成,一旦您习惯了它,它可以帮助您快速入门。

Just to add ,
Yii scales very nicely in both directions (ie functionality addition using new modules etc and is one of the fastest php frameworks when it comes to performance ).
The only drawback I can see with Yii is that it has lesser user base so a bit lesser support than some other frameworks, but this is changing fast.
The best part of Yii is the gii based code generation which helps you get started really quickly once you get used to it.

乖不如嘢 2024-11-16 03:19:50

Yii 是一个非常灵活、轻量且易于学习的 PHP 框架。

Yii is very flexible, light and easy to learn PHP framework.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文