大型定制调查/报告应用程序 - 最佳实践

发布于 2024-07-07 15:59:13 字数 551 浏览 9 评论 0原文

情况

当您学习社会科学时,您经常会遇到在线调查(在线科学数据收集)的需求。 这是我最初使用 PHP 的主要原因之一。

最近,这些调查应用程序不断增长。 添加了很多复杂性:报告(闪存图、PDF 生成)、数据聚合、不同级别的聚合(例如公司单位)、所涉及公司的调查问卷模块选择等。

现在我明白了我自己遇到了一个复杂的数据收集和报告应用程序,它变得缓慢且难以维护

我的一个平台每天新增用户多达 100 名,并汇总/报告多个数千用户的数据数百个数据项 数十个层次结构级别

我的问题

  • 是PHP/mysql还有路要走吗?
  • 像 codeIgnitor 这样的框架可以作为此类应用程序的基础吗?还是我应该从头开始开发所有内容?
  • 您知道我可以用作基础的任何类型的调查特定框架吗?

The situation

When you study social sciences, you are frequently confronted with the need for online surveys (scientific data collection online). That's one of the main reasons why I started with PHP in the first place.

Recently these survey applications have grown and grown. A lot of complexity has been added: reporting (flash charts, PDF generation), data aggregation, different levels of aggregation (e.g. company units), questionnaire module selection for the companies involved, etc.

Now I see myself confronted with a complex data gathering and reporting application which is getting slow and unmaintainable.

One of my platforms has up to 100 new users per day and aggregates / reports data of several thousend users times hundreds of data items times dozens of hierarchy levels.

My questions

  • is PHP/mysql still a way to go?
  • could a framework like codeIgnitor be a basis for such an application or should I develop everything from the scratch?
  • do you know any kind of survey specific framework I could use as a basis?

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

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

发布评论

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

评论(3

错爱 2024-07-14 15:59:13

PHP/mysql还有路要走吗?

是的,PHP/MYSQL (LAMP) 已成功用于数百个网站,其用户群比您的网站大得多。

像 codeIgnitor 这样的框架可以成为此类应用程序的基础吗?还是我应该从头开始开发一切?

没有框架(或自定义构建的框架)构建的重要 PHP 站点往往会变得很快。 PHP 框架现在已经成为入门的标准,我个人推荐 Zend Framework。 它是一个非常强大的框架,为许多常见的 PHP 任务提供了工具(数据库、日期、JSON、RPC、REST 的替换/增强)以及用于 Web 应用程序开发的有组织的方法:MVC 使用 Zend_Controller

您知道我可以用作基础的任何类型的调查特定框架吗?

据我所知,但您可能想尝试使用 Zend_Form 从配置文件自动生成表单元素(类型、过滤器、清理器、验证器)。

is PHP/mysql still a way to go?

Yes, PHP/MYSQL (LAMP) has been successfully used in hundreds of sites with exponentially larger user bases than yours.

could a framework like codeIgnitor be a basis for such an application or should I develop everything from the scratch?

Nontrivial PHP sites built without a framework (or a custom built framework) tends to get sloppy fast. PHP frameworks are now the norm for getting started, I would personally recommend the Zend Framework. It's a very robust framework, providing tools for many common PHP tasks (replacement/enhancements for Database, Date, JSON, RPC, REST) and an organized methodology for web application development: MVC using Zend_Controller.

do you know any kind of survey specific framework I could use as a basis?

None that I know of, but you may want to try using Zend_Form to automatically generate form elements (type, filters, sanitizers, validators) from configuration files.

浅唱々樱花落 2024-07-14 15:59:13

PHP/mysql 应该适合这个规模,但您必须对其进行调整并为其提供足够的资源。

例如,如果您的架构没有经过深思熟虑,您将遇到各种性能障碍。 数据的存储和索引方式可能是影响报告性能的最重要因素。 我在 mysql 中有 60-100GB 的数据,对于稍微复杂的查询,响应时间为亚秒级。 重要的因素是:

  • 我的数据按照我使用的方式建立了索引
  • 我使用的查询经过深思熟虑、测试和优化

接下来,您必须为 MySQL 服务器提供足够的资源。 如果您在共享托管服务器上运行应用程序并且使用开箱即用的设置,则 mysql 可能无法在处理超过数百 mb 的数据时正常运行。 确保您的缓存已调整,您的表类型对您的应用程序有意义,并且您有足够的内存和足够快的磁盘来满足您的性能需求。

最后,当我们的数据集变大时,我们都会使用一个技巧:在 cron 上生成报告,而不是按需生成报告。 如果生成 Flash 图需要 2 分钟,请每 5 分钟运行一次 cron 来生成数据。 将其保存在某个文件中,然后将其输出到绘图软件,而不是实时查询数据库。

PHP/mysql should be fine for this scale, but you must tune it and give it sufficient resources.

For example, if your schema is not thought out, you'll hit all sorts of performance walls. How your data is stored and indexed is probably the most important factor for the performance of reports. I've had 60-100gb of data in mysql with sub-second response times for mildly complex queries. The important factors were:

  • my data was indexed for the ways I used it
  • the queries I used were thought out, tested and optimized

Next up, you must give your MySQL server sufficient resources. If you're running your app on a shared hosted server and you're using the out of the box settings, mysql probably won't run well with more than a few hundred mb's of data. Make sure your caches are tuned, your table types make sense for your application and you have enough memory and fast enough disks to meet your performance needs.

And finally, there's a trick we all use when our data sets get big: generate your reports on a cron instead of on demand. If it takes 2 minutes to generate a flash graph, have a cron run every 5 minutes to generate the data. Stick it in a file somewhere and spit that out to the graphing software instead of querying the database in real time.

梦里人 2024-07-14 15:59:13

您应该查看开源 Limesurvey 应用程序。

它使用 PHP/Mysql,因此解决了您关于 PHP 是否适合该任务的问题之一。

Limesurvey 的先前版本是用 CodeIgniter 编写的,但在 CodeIgniter 许可证的不确定性和混乱之后,项目负责人更改为 Yii 框架。

你的第三个问题,上面已经回答了。

参考 :
https://www.limesurvey.org/

You should look into the Open Source Limesurvey application.

It use PHP/Mysql, so that addresses one of your questions regarding the appropriateness of PHP for the task.

The previous version of Limesurvey was written in CodeIgniter, but the projects lead changed to the Yii framework after uncertainty and confusion about CodeIgniter licenses.

Your third question has been answered above.

References :
https://www.limesurvey.org/

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