Table of Contents
回复内容:
Home Backend Development PHP Tutorial 关于大并发在线实时图像处理的解决方案

关于大并发在线实时图像处理的解决方案

Jun 06, 2016 pm 08:49 PM
node.js php python redis

最近有个项目,需要做个图片合成的功能
大概是类似这个站 http://www.teeume.com/goods/2408.html

关于大并发在线实时图像处理的解决方案
选择不同的颜色,图案会叠加子啊不同的背景上.

目前我是用PHP实现,但考虑到日后大并发的情况,PHP可能难以应付,当然这里会用到一些缓存技术,比如DoubanDB,把首次生成的图片放在DoubanDB

不知道这块能否有更好的方案,比如用其他方式生成,python,ruby,nodejs...php

另外据说php连redis的性能不怎么样,跟连mysql差很远,是否改成python连接好一些呢?

回复内容:

最近有个项目,需要做个图片合成的功能
大概是类似这个站 http://www.teeume.com/goods/2408.html

关于大并发在线实时图像处理的解决方案
选择不同的颜色,图案会叠加子啊不同的背景上.

目前我是用PHP实现,但考虑到日后大并发的情况,PHP可能难以应付,当然这里会用到一些缓存技术,比如DoubanDB,把首次生成的图片放在DoubanDB

不知道这块能否有更好的方案,比如用其他方式生成,python,ruby,nodejs...php

另外据说php连redis的性能不怎么样,跟连mysql差很远,是否改成python连接好一些呢?

不知道你的项目有“多大”,但是我想说,PHP处理这么几张图片不在话下。

做个总结吧: 1.PHP怎么做

一款T恤6个颜色(也可以多个),那就是1x6,你的网站现在有多少款T恤呢?每天提交量多少呢,这个完全能估出来。

假如1000提交/天,那么就是1000x6/24/60;每分钟处理4张图片,很难么?

2.怎么存,一个款式6个颜色,一个颜色一张图片,图片放硬盘,至于数据放哪里?mysql、redis,这个随你了,不过我个人会选择mysql,因为这个和我的SKU挂钩的哦;再比如我需要每月统计哪个sku卖的好,mysql最合适不过了

3.如果用户需要前端操作怎么办?比如用户需要移动T恤图案位置,大小什么的。咯,楼下说了canvas,不占用你的服务器资源的哦,不过你要考虑考虑兼容哦,解决的办法也有很多SVG,flash,这个不在问题范围内,不详细说明

答案应该是不需要处理图片吧???
直接记录贴图的位置信息,角度信息,底板信息就行了。php就足够。
另外,如果非要生成图片,建议别用fpm,进程不够会卡住。

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
WWE 2K25: How To Unlock Everything In MyRise
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

The Future of PHP: Adaptations and Innovations The Future of PHP: Adaptations and Innovations Apr 11, 2025 am 12:01 AM

The future of PHP will be achieved by adapting to new technology trends and introducing innovative features: 1) Adapting to cloud computing, containerization and microservice architectures, supporting Docker and Kubernetes; 2) introducing JIT compilers and enumeration types to improve performance and data processing efficiency; 3) Continuously optimize performance and promote best practices.

PHP vs. Python: Understanding the Differences PHP vs. Python: Understanding the Differences Apr 11, 2025 am 12:15 AM

PHP and Python each have their own advantages, and the choice should be based on project requirements. 1.PHP is suitable for web development, with simple syntax and high execution efficiency. 2. Python is suitable for data science and machine learning, with concise syntax and rich libraries.

How to build the redis cluster mode How to build the redis cluster mode Apr 10, 2025 pm 10:15 PM

Redis cluster mode deploys Redis instances to multiple servers through sharding, improving scalability and availability. The construction steps are as follows: Create odd Redis instances with different ports; Create 3 sentinel instances, monitor Redis instances and failover; configure sentinel configuration files, add monitoring Redis instance information and failover settings; configure Redis instance configuration files, enable cluster mode and specify the cluster information file path; create nodes.conf file, containing information of each Redis instance; start the cluster, execute the create command to create a cluster and specify the number of replicas; log in to the cluster to execute the CLUSTER INFO command to verify the cluster status; make

PHP: Is It Dying or Simply Adapting? PHP: Is It Dying or Simply Adapting? Apr 11, 2025 am 12:13 AM

PHP is not dying, but constantly adapting and evolving. 1) PHP has undergone multiple version iterations since 1994 to adapt to new technology trends. 2) It is currently widely used in e-commerce, content management systems and other fields. 3) PHP8 introduces JIT compiler and other functions to improve performance and modernization. 4) Use OPcache and follow PSR-12 standards to optimize performance and code quality.

The 2-Hour Python Plan: A Realistic Approach The 2-Hour Python Plan: A Realistic Approach Apr 11, 2025 am 12:04 AM

You can learn basic programming concepts and skills of Python within 2 hours. 1. Learn variables and data types, 2. Master control flow (conditional statements and loops), 3. Understand the definition and use of functions, 4. Quickly get started with Python programming through simple examples and code snippets.

How to use the redis command How to use the redis command Apr 10, 2025 pm 08:45 PM

Using the Redis directive requires the following steps: Open the Redis client. Enter the command (verb key value). Provides the required parameters (varies from instruction to instruction). Press Enter to execute the command. Redis returns a response indicating the result of the operation (usually OK or -ERR).

How to use redis lock How to use redis lock Apr 10, 2025 pm 08:39 PM

Using Redis to lock operations requires obtaining the lock through the SETNX command, and then using the EXPIRE command to set the expiration time. The specific steps are: (1) Use the SETNX command to try to set a key-value pair; (2) Use the EXPIRE command to set the expiration time for the lock; (3) Use the DEL command to delete the lock when the lock is no longer needed.

How to read redis queue How to read redis queue Apr 10, 2025 pm 10:12 PM

To read a queue from Redis, you need to get the queue name, read the elements using the LPOP command, and process the empty queue. The specific steps are as follows: Get the queue name: name it with the prefix of "queue:" such as "queue:my-queue". Use the LPOP command: Eject the element from the head of the queue and return its value, such as LPOP queue:my-queue. Processing empty queues: If the queue is empty, LPOP returns nil, and you can check whether the queue exists before reading the element.

See all articles