当前位置:首页>python>Python multiprocessing模块详细介绍

Python multiprocessing模块详细介绍

  • 2026-01-31 19:13:16
Python multiprocessing模块详细介绍

1. 创始时间与作者

  • 创始时间multiprocessing 模块首次出现在 Python 2.6 版本中,于 2008年10月 发布

  • 核心开发者

    • Jesse Noller:multiprocessing 模块的主要作者

    • Richard Oudkerk:对进程池和共享内存有重要贡献

    • Python 核心团队:持续改进和优化多进程支持

  • 项目定位:Python 标准多进程库,提供真正的并行计算能力,绕过 GIL 限制

2. 官方资源

  • Python 官方文档https://docs.python.org/3/library/multiprocessing.html

  • 源码地址https://github.com/python/cpython/tree/main/Lib/multiprocessing

  • PEP 371https://www.python.org/dev/peps/pep-0371/

  • 教程指南https://docs.python.org/3/library/multiprocessing.html

3. 核心功能

4. 应用场景

1. 基础多进程编程
import multiprocessingimport osimport timedef worker_process(process_idduration):"""工作进程函数"""print(f"进程 {process_id} (PID: {os.getpid()}) 开始执行")start_time = time.time()# 模拟 CPU 密集型工作result = 0for in range(10**7):result += i*iend_time = time.time()print(f"进程 {process_id} 完成,耗时: {end_time - start_time:.2f}秒")return resultdef basic_multiprocessing_demo():"""基础多进程演示"""processes = []# 创建并启动多个进程for in range(4):process = multiprocessing.Process(target=worker_processargs=(i2)        )processes.append(process)process.start()print(f"启动进程 {i}")# 等待所有进程完成for iprocess in enumerate(processes):process.join()print(f"进程 {i} 已加入")print("所有进程执行完毕")if __name__ == '__main__':basic_multiprocessing_demo()
2. 进程池与并行计算
import multiprocessingimport timeimport mathdef cpu_intensive_task(n):"""CPU 密集型任务:计算素数"""print(f"开始计算 {n} 以内的素数")def is_prime(num):if num<2:return Falsefor in range(2int(math.sqrt(num)) +1):if num%i == 0:return Falsereturn Trueprimes = [for in range(2n+1if is_prime(i)]return len(primes)def pool_demo():"""进程池演示"""print(f"可用的 CPU 核心数: {multiprocessing.cpu_count()}")# 创建进程池,使用所有可用的 CPU 核心with multiprocessing.Pool() as pool:# 准备任务tasks = [100000200000300000400000500000]# 方法1: map - 阻塞式执行print("=== map 方法 ===")start_time = time.time()results_map = pool.map(cpu_intensive_tasktasks)map_time = time.time() -start_time# 方法2: map_async - 异步执行print("=== map_async 方法 ===")start_time = time.time()async_result = pool.map_async(cpu_intensive_tasktasks)results_async = async_result.get()async_time = time.time() -start_time# 方法3: apply_async - 逐个提交任务print("=== apply_async 方法 ===")start_time = time.time()async_results = []for task in tasks:result = pool.apply_async(cpu_intensive_task, (task,))async_results.append(result)results_apply = [r.get() for in async_results]apply_time = time.time() -start_time# 输出结果for i, (taskresultin enumerate(zip(tasksresults_map)):print(f"任务 {i}: {task} 以内的素数个数 = {result}")print(f"\n性能比较:")print(f"map 耗时: {map_time:.2f}秒")print(f"map_async 耗时: {async_time:.2f}秒")print(f"apply_async 耗时: {apply_time:.2f}秒")if __name__ == '__main__':pool_demo()
3. 进程间通信与数据共享
import multiprocessingimport timeimport randomdef producer(queueproducer_idnum_items):"""生产者进程"""for in range(num_items):item = f"产品-{producer_id}-{i}"# 模拟生产时间time.sleep(random.uniform(0.10.3))queue.put(item)print(f"生产者 {producer_id} 生产了: {item}")# 发送结束信号queue.put(f"生产者-{producer_id}-结束")def consumer(queueconsumer_idshared_counter):"""消费者进程"""processed_count = 0while True:item = queue.get()if item.endswith("-结束"):# 如果是结束信号,放回队列以便其他消费者也能看到queue.put(item)print(f"消费者 {consumer_id} 接收到结束信号")break# 模拟消费时间time.sleep(random.uniform(0.20.5))print(f"消费者 {consumer_id} 消费了: {item}")processed_count += 1# 更新共享计数器with shared_counter.get_lock():shared_counter.value += 1print(f"消费者 {consumer_id} 退出,共处理了 {processed_count} 个项目")return processed_countdef shared_memory_demo():"""共享内存演示"""# 创建进程间队列queue = multiprocessing.Queue(maxsize=10)# 创建共享计数器shared_counter = multiprocessing.Value('i'0)  # 'i' 表示整数类型# 创建生产者和消费者进程producers = []consumers = []# 启动生产者for in range(2):producer_process = multiprocessing.Process(target=producerargs=(queuei5)        )producers.append(producer_process)producer_process.start()# 启动消费者for in range(3):consumer_process = multiprocessing.Process(target=consumerargs=(queueishared_counter)        )consumers.append(consumer_process)consumer_process.start()# 等待生产者完成for producer in producers:producer.join()# 等待消费者完成for consumer in consumers:consumer.join()print(f"\n总共处理的项目数: {shared_counter.value}")if __name__ == '__main__':shared_memory_demo()
4. 高级数据共享与同步
import multiprocessingimport timeimport numpy as npdef matrix_worker(worker_idshared_arraylockrows_per_workermatrix_size):"""矩阵计算工作进程"""print(f"工作进程 {worker_id} 开始计算")# 将共享内存转换为 numpy 数组with lock:matrix = np.frombuffer(shared_array.get_obj()).reshape(            (matrix_sizematrix_size)        )# 计算分配的行start_row = worker_id*rows_per_workerend_row = min((worker_id+1*rows_per_workermatrix_size)# 执行矩阵运算(这里简单填充值)for in range(start_rowend_row):for in range(matrix_size):# 使用锁保护共享内存访问with lock:matrix[ij] = i*matrix_size+j+worker_id*0.1print(f"工作进程 {worker_id} 完成计算行 {start_row} 到 {end_row-1}")def advanced_shared_memory_demo():"""高级共享内存演示"""matrix_size = 100num_workers = 4# 创建共享内存数组shared_array = multiprocessing.Array('d'matrix_size*matrix_size# 'd' 表示双精度浮点数    )# 创建锁lock = multiprocessing.Lock()# 计算每个工作进程处理的行数rows_per_worker = matrix_size//num_workers# 创建工作进程workers = []start_time = time.time()for in range(num_workers):worker = multiprocessing.Process(target=matrix_worker,args=(ishared_arraylockrows_per_workermatrix_size)        )workers.append(worker)worker.start()# 等待所有工作进程完成for worker in workers:worker.join()end_time = time.time()# 将结果转换为 numpy 数组并显示部分结果with lock:result_matrix = np.frombuffer(shared_array.get_obj()).reshape(            (matrix_sizematrix_size)        )print(f"\n计算完成,耗时: {end_time - start_time:.2f}秒")print("矩阵左上角 5x5 部分:")print(result_matrix[:5, :5])# 验证结果expected_sum = sum(i*matrix_size+jfor in range(matrix_sizefor in range(matrix_size))actual_sum = np.sum(result_matrix)print(f"\n期望总和: {expected_sum}")print(f"实际总和: {actual_sum}")print(f"差异: {abs(actual_sum - expected_sum)}")if __name__ == '__main__':advanced_shared_memory_demo()

5. 底层逻辑与技术原理

核心架构
关键技术
  1. 进程创建机制

    • Windows:使用 CreateProcess API

    • Linux/Unix:使用 fork 系统调用

    • macOS:使用 fork 或 posix_spawn

  2. 进程间通信(IPC)

    • 队列(Queue):基于管道和序列化

    • 管道(Pipe):双向或单向通信通道

    • 共享内存:使用 mmap 或系统共享内存

    • 信号量:系统级同步原语

  3. 数据序列化

    • 使用 pickle 模块序列化 Python 对象

    • 共享内存绕过序列化,直接操作内存

    • 管理器(Manager)提供高级对象共享

  4. GIL 绕过机制

    # 每个进程有独立的 Python 解释器和 GIL# 真正的并行执行,不受 GIL 限制# 适合 CPU 密集型任务
  5. 资源管理

    • 进程池重用进程,减少创建开销

    • 自动清理僵尸进程

    • 优雅的进程终止机制

进程启动方法
import multiprocessing as mp# 不同的进程启动方法if __name__ == '__main__':# 查看可用的启动方法print("可用启动方法:"mp.get_all_start_methods())# 设置启动方法mp.set_start_method('spawn')  # 或 'fork', 'forkserver'# 创建进程上下文ctx = mp.get_context('spawn')# 使用指定上下文创建进程with ctx.Pool(4as pool:results = pool.map(lambda xx*xrange(10))print(results)

6. 安装与配置

基础安装
# multiprocessing 是 Python 标准库的一部分,无需额外安装# 验证安装python -c"import multiprocessing; print(multiprocessing.__doc__)"
环境要求
组件最低要求推荐配置
Python2.6+3.6+
操作系统Windows 7+/Linux 2.6+/macOS 10.6+同左
内存1GB8GB+
CPU多核多核多线程
平台差异配置
import multiprocessingimport platformimport osdef check_environment():"""检查多进程环境"""print(f"Python 版本: {platform.python_version()}")print(f"操作系统: {platform.system()} {platform.release()}")print(f"CPU 核心数: {multiprocessing.cpu_count()}")print(f"当前进程 PID: {os.getpid()}")# 检查启动方法try:methods = multiprocessing.get_all_start_methods()current_method = multiprocessing.get_start_method()print(f"可用启动方法: {methods}")print(f"当前启动方法: {current_method}")except AttributeError:print("启动方法检查不可用")if __name__ == '__main__':check_environment()

7. 性能指标

操作类型执行时间内存开销适用场景
进程创建10-100ms10-50MB长期运行任务
进程间通信0.1-1ms可忽略频繁数据交换
进程池初始化100-500ms每个进程独立批量任务处理
共享内存访问0.01-0.1ms共享大数据处理

8. 高级功能使用

1. 自定义进程类
import multiprocessingimport timeimport queueclass WorkerProcess(multiprocessing.Process):"""自定义工作进程类"""def __init__(selftask_queueresult_queueworker_idtimeout=5):super().__init__()self.task_queue = task_queueself.result_queue = result_queueself.worker_id = worker_idself.timeout = timeoutself.shutdown_flag = multiprocessing.Event()def run(self):"""进程主函数"""print(f"工作进程 {self.worker_id} 启动 (PID: {self.pid})")while not self.shutdown_flag.is_set():try:# 获取任务,支持超时task = self.task_queue.get(timeout=self.timeout)if task == "SHUTDOWN":print(f"工作进程 {self.worker_id} 接收到关闭信号")break# 处理任务result = self.process_task(task)self.result_queue.put((self.worker_idtaskresult))except queue.Empty:# 超时,检查是否需要关闭continueexcept Exception as e:print(f"工作进程 {self.worker_id} 错误: {e}")self.result_queue.put((self.worker_id"ERROR"str(e)))print(f"工作进程 {self.worker_id} 退出")def process_task(selftask):"""处理具体任务"""print(f"工作进程 {self.worker_id} 处理任务: {task}")time.sleep(1)  # 模拟处理时间return f"处理结果: {task.upper()}"def shutdown(self):"""优雅关闭进程"""self.shutdown_flag.set()def custom_process_demo():"""自定义进程演示"""# 创建队列task_queue = multiprocessing.Queue()result_queue = multiprocessing.Queue()# 创建自定义工作进程workers = []num_workers = 3for in range(num_workers):worker = WorkerProcess(task_queueresult_queuei)workers.append(worker)worker.start()# 提交任务tasks = [f"task_{i}" for in range(10)]for task in tasks:task_queue.put(task)# 等待任务完成time.sleep(2)# 收集结果results = []while not result_queue.empty():try:result = result_queue.get_nowait()results.append(result)print(f"收到结果: {result}")except queue.Empty:break# 发送关闭信号for in range(num_workers):task_queue.put("SHUTDOWN")# 等待进程退出for worker in workers:worker.join(timeout=10)if worker.is_alive():worker.terminate()print("自定义进程演示完成")if __name__ == '__main__':custom_process_demo()
2. 管理器(Manager)实现复杂数据共享
import multiprocessingimport timefrom multiprocessing.managers import BaseManagerclass TaskManager:"""任务管理器"""def __init__(self):self.tasks = {}self.results = {}self.lock = multiprocessing.Lock()def add_task(selftask_idtask_data):"""添加任务"""with self.lock:self.tasks[task_id] = {'data'task_data,'status''pending','created_at'time.time()            }return Truedef get_task(self):"""获取待处理任务"""with self.lock:for task_idtask_info in self.tasks.items():if task_info['status'] == 'pending':task_info['status'] = 'processing'task_info['started_at'] = time.time()return task_idtask_info['data']return NoneNonedef complete_task(selftask_idresult):"""完成任务"""with self.lock:if task_id in self.tasks:self.tasks[task_id]['status'] = 'completed'self.tasks[task_id]['completed_at'] = time.time()self.results[task_id] = resultreturn Truedef get_stats(self):"""获取统计信息"""with self.lock:stats = {'total_tasks'len(self.tasks),'pending_tasks'sum(for in self.tasks.values() if t['status'] == 'pending'),'processing_tasks'sum(for in self.tasks.values() if t['status'] == 'processing'),'completed_tasks'sum(for in self.tasks.values() if t['status'] == 'completed'),            }return statsdef worker_process(managerworker_id):"""工作进程"""print(f"工作进程 {worker_id} 启动")while True:# 获取任务task_idtask_data = manager.get_task()if task_id is None:# 没有任务,等待后重试time.sleep(1)continueif task_data == "SHUTDOWN":print(f"工作进程 {worker_id} 接收到关闭信号")break# 处理任务print(f"工作进程 {worker_id} 处理任务 {task_id}: {task_data}")time.sleep(2)  # 模拟处理时间# 完成任务result = f"Worker {worker_id} processed: {task_data}"manager.complete_task(task_idresult)print(f"工作进程 {worker_id} 退出")def manager_demo():"""管理器演示"""# 创建自定义管理器class TaskManagerManager(BaseManager):passTaskManagerManager.register('TaskManager'TaskManager)# 启动管理器with TaskManagerManager() as manager:task_manager = manager.TaskManager()# 创建工作进程workers = []num_workers = 3for in range(num_workers):worker = multiprocessing.Process(target=worker_processargs=(task_manageri)            )workers.append(worker)worker.start()# 添加任务for in range(10):task_manager.add_task(f"task_{i}"f"data_{i}")# 监控进度for in range(5):stats = task_manager.get_stats()print(f"任务统计: {stats}")time.sleep(2)# 添加关闭任务for in range(num_workers):task_manager.add_task(f"shutdown_{i}""SHUTDOWN")# 等待工作进程退出for worker in workers:worker.join()print("管理器演示完成")if __name__ == '__main__':manager_demo()

9. 与同类工具对比

特性multiprocessingthreadingconcurrent.futuresjoblib
并发模型进程线程线程/进程池进程池
GIL 影响受限制进程池无,线程池有
内存开销进程池高,线程池低
数据共享需要 IPC直接共享进程池需要 IPC需要序列化
适用场景CPU 密集型I/O 密集型I/O 和 CPU 密集型数值计算
编程复杂度中等

10. 企业级应用案例

  1. 科学计算

    • NumPy、SciPy 使用多进程进行并行计算

    • 大规模数值模拟和数据处理

  2. 机器学习

    • Scikit-learn 使用多进程进行超参数调优

    • 并行特征工程和模型训练

  3. 数据处理

    • Pandas 数据框的并行处理

    • 大规模 ETL(提取、转换、加载)流程

  4. Web 服务

    • Gunicorn 等多进程 Web 服务器

    • 并行处理多个客户端请求

  5. 金融分析

    • 蒙特卡洛模拟

    • 并行风险评估和投资组合优化


总结

Python multiprocessing 是 CPU 密集型并行计算的终极解决方案,核心价值在于:

  1. 真正的并行:绕过 GIL 限制,实现真正的多核并行

  2. 功能丰富:提供完整的进程管理、通信和同步机制

  3. 稳定可靠:进程隔离确保单个进程崩溃不影响整体

  4. 灵活配置:支持多种进程启动方法和资源管理策略

技术亮点

  • 进程池和任务队列简化并行编程

  • 多种进程间通信方式(队列、管道、共享内存)

  • 灵活的同步原语和共享数据机制

  • 跨平台兼容性和自动资源管理

适用场景

  • CPU 密集型计算任务

  • 需要真正并行执行的应用

  • 大规模数据处理和数值计算

  • 需要进程隔离的稳定系统

安装使用

# 无需安装,直接导入python -c"import multiprocessing; print('multiprocessing 模块可用')"

学习资源

  • 官方文档:https://docs.python.org/3/library/multiprocessing.html

  • 并发编程指南:https://docs.python.org/3/library/concurrency.html

  • 实战教程:https://realpython.com/python-concurrency/

Python multiprocessing 模块虽然进程间通信开销较大,但在需要真正并行计算的场景中是不可替代的工具,特别适合科学计算、数据分析和机器学习等 CPU 密集型任务。

最新文章

随机文章

基本 文件 流程 错误 SQL 调试
  1. 请求信息 : 2026-02-07 18:28:41 HTTP/2.0 GET : https://f.mffb.com.cn/a/469870.html
  2. 运行时间 : 0.734261s [ 吞吐率:1.36req/s ] 内存消耗:4,698.20kb 文件加载:140
  3. 缓存信息 : 0 reads,0 writes
  4. 会话信息 : SESSION_ID=4e2191a60b0eee6524b5daf79a290a86
  1. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/public/index.php ( 0.79 KB )
  2. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/autoload.php ( 0.17 KB )
  3. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/autoload_real.php ( 2.49 KB )
  4. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/platform_check.php ( 0.90 KB )
  5. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/ClassLoader.php ( 14.03 KB )
  6. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/autoload_static.php ( 4.90 KB )
  7. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/helper.php ( 8.34 KB )
  8. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-validate/src/helper.php ( 2.19 KB )
  9. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/helper.php ( 1.47 KB )
  10. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/stubs/load_stubs.php ( 0.16 KB )
  11. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Exception.php ( 1.69 KB )
  12. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-container/src/Facade.php ( 2.71 KB )
  13. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/deprecation-contracts/function.php ( 0.99 KB )
  14. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/polyfill-mbstring/bootstrap.php ( 8.26 KB )
  15. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/polyfill-mbstring/bootstrap80.php ( 9.78 KB )
  16. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/var-dumper/Resources/functions/dump.php ( 1.49 KB )
  17. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-dumper/src/helper.php ( 0.18 KB )
  18. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/var-dumper/VarDumper.php ( 4.30 KB )
  19. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/App.php ( 15.30 KB )
  20. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-container/src/Container.php ( 15.76 KB )
  21. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/container/src/ContainerInterface.php ( 1.02 KB )
  22. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/provider.php ( 0.19 KB )
  23. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Http.php ( 6.04 KB )
  24. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/helper/Str.php ( 7.29 KB )
  25. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Env.php ( 4.68 KB )
  26. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/common.php ( 0.03 KB )
  27. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/helper.php ( 18.78 KB )
  28. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Config.php ( 5.54 KB )
  29. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/app.php ( 0.95 KB )
  30. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/cache.php ( 0.78 KB )
  31. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/console.php ( 0.23 KB )
  32. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/cookie.php ( 0.56 KB )
  33. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/database.php ( 2.48 KB )
  34. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/facade/Env.php ( 1.67 KB )
  35. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/filesystem.php ( 0.61 KB )
  36. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/lang.php ( 0.91 KB )
  37. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/log.php ( 1.35 KB )
  38. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/middleware.php ( 0.19 KB )
  39. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/route.php ( 1.89 KB )
  40. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/session.php ( 0.57 KB )
  41. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/trace.php ( 0.34 KB )
  42. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/view.php ( 0.82 KB )
  43. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/event.php ( 0.25 KB )
  44. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Event.php ( 7.67 KB )
  45. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/service.php ( 0.13 KB )
  46. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/AppService.php ( 0.26 KB )
  47. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Service.php ( 1.64 KB )
  48. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Lang.php ( 7.35 KB )
  49. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/lang/zh-cn.php ( 13.70 KB )
  50. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/initializer/Error.php ( 3.31 KB )
  51. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/initializer/RegisterService.php ( 1.33 KB )
  52. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/services.php ( 0.14 KB )
  53. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/service/PaginatorService.php ( 1.52 KB )
  54. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/service/ValidateService.php ( 0.99 KB )
  55. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/service/ModelService.php ( 2.04 KB )
  56. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-trace/src/Service.php ( 0.77 KB )
  57. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Middleware.php ( 6.72 KB )
  58. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/initializer/BootService.php ( 0.77 KB )
  59. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/Paginator.php ( 11.86 KB )
  60. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-validate/src/Validate.php ( 63.20 KB )
  61. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/Model.php ( 23.55 KB )
  62. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/Attribute.php ( 21.05 KB )
  63. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/AutoWriteData.php ( 4.21 KB )
  64. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/Conversion.php ( 6.44 KB )
  65. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/DbConnect.php ( 5.16 KB )
  66. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/ModelEvent.php ( 2.33 KB )
  67. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/RelationShip.php ( 28.29 KB )
  68. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/contract/Arrayable.php ( 0.09 KB )
  69. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/contract/Jsonable.php ( 0.13 KB )
  70. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/contract/Modelable.php ( 0.09 KB )
  71. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Db.php ( 2.88 KB )
  72. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/DbManager.php ( 8.52 KB )
  73. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Log.php ( 6.28 KB )
  74. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Manager.php ( 3.92 KB )
  75. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/log/src/LoggerTrait.php ( 2.69 KB )
  76. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/log/src/LoggerInterface.php ( 2.71 KB )
  77. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Cache.php ( 4.92 KB )
  78. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/simple-cache/src/CacheInterface.php ( 4.71 KB )
  79. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/helper/Arr.php ( 16.63 KB )
  80. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/cache/driver/File.php ( 7.84 KB )
  81. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/cache/Driver.php ( 9.03 KB )
  82. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/CacheHandlerInterface.php ( 1.99 KB )
  83. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/Request.php ( 0.09 KB )
  84. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Request.php ( 55.78 KB )
  85. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/middleware.php ( 0.25 KB )
  86. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Pipeline.php ( 2.61 KB )
  87. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-trace/src/TraceDebug.php ( 3.40 KB )
  88. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/middleware/SessionInit.php ( 1.94 KB )
  89. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Session.php ( 1.80 KB )
  90. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/session/driver/File.php ( 6.27 KB )
  91. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/SessionHandlerInterface.php ( 0.87 KB )
  92. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/session/Store.php ( 7.12 KB )
  93. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Route.php ( 23.73 KB )
  94. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/RuleName.php ( 5.75 KB )
  95. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/Domain.php ( 2.53 KB )
  96. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/RuleGroup.php ( 22.43 KB )
  97. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/Rule.php ( 26.95 KB )
  98. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/RuleItem.php ( 9.78 KB )
  99. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/route/app.php ( 1.72 KB )
  100. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/facade/Route.php ( 4.70 KB )
  101. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/dispatch/Controller.php ( 4.74 KB )
  102. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/Dispatch.php ( 10.44 KB )
  103. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/controller/Index.php ( 4.81 KB )
  104. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/BaseController.php ( 2.05 KB )
  105. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/facade/Db.php ( 0.93 KB )
  106. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/connector/Mysql.php ( 5.44 KB )
  107. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/PDOConnection.php ( 52.47 KB )
  108. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/Connection.php ( 8.39 KB )
  109. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/ConnectionInterface.php ( 4.57 KB )
  110. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/builder/Mysql.php ( 16.58 KB )
  111. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/Builder.php ( 24.06 KB )
  112. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/BaseBuilder.php ( 27.50 KB )
  113. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/Query.php ( 15.71 KB )
  114. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/BaseQuery.php ( 45.13 KB )
  115. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/TimeFieldQuery.php ( 7.43 KB )
  116. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/AggregateQuery.php ( 3.26 KB )
  117. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/ModelRelationQuery.php ( 20.07 KB )
  118. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/ParamsBind.php ( 3.66 KB )
  119. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/ResultOperation.php ( 7.01 KB )
  120. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/WhereQuery.php ( 19.37 KB )
  121. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/JoinAndViewQuery.php ( 7.11 KB )
  122. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/TableFieldInfo.php ( 2.63 KB )
  123. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/Transaction.php ( 2.77 KB )
  124. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/log/driver/File.php ( 5.96 KB )
  125. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/LogHandlerInterface.php ( 0.86 KB )
  126. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/log/Channel.php ( 3.89 KB )
  127. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/event/LogRecord.php ( 1.02 KB )
  128. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/Collection.php ( 16.47 KB )
  129. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/facade/View.php ( 1.70 KB )
  130. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/View.php ( 4.39 KB )
  131. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Response.php ( 8.81 KB )
  132. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/response/View.php ( 3.29 KB )
  133. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Cookie.php ( 6.06 KB )
  134. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-view/src/Think.php ( 8.38 KB )
  135. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/TemplateHandlerInterface.php ( 1.60 KB )
  136. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-template/src/Template.php ( 46.61 KB )
  137. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-template/src/template/driver/File.php ( 2.41 KB )
  138. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-template/src/template/contract/DriverInterface.php ( 0.86 KB )
  139. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/runtime/temp/067d451b9a0c665040f3f1bdd3293d68.php ( 11.98 KB )
  140. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-trace/src/Html.php ( 4.42 KB )
  1. CONNECT:[ UseTime:0.000983s ] mysql:host=127.0.0.1;port=3306;dbname=f_mffb;charset=utf8mb4
  2. SHOW FULL COLUMNS FROM `fenlei` [ RunTime:0.001469s ]
  3. SELECT * FROM `fenlei` WHERE `fid` = 0 [ RunTime:0.018477s ]
  4. SELECT * FROM `fenlei` WHERE `fid` = 63 [ RunTime:0.040362s ]
  5. SHOW FULL COLUMNS FROM `set` [ RunTime:0.001806s ]
  6. SELECT * FROM `set` [ RunTime:0.074951s ]
  7. SHOW FULL COLUMNS FROM `article` [ RunTime:0.001725s ]
  8. SELECT * FROM `article` WHERE `id` = 469870 LIMIT 1 [ RunTime:0.075462s ]
  9. UPDATE `article` SET `lasttime` = 1770460122 WHERE `id` = 469870 [ RunTime:0.006316s ]
  10. SELECT * FROM `fenlei` WHERE `id` = 66 LIMIT 1 [ RunTime:0.043279s ]
  11. SELECT * FROM `article` WHERE `id` < 469870 ORDER BY `id` DESC LIMIT 1 [ RunTime:0.129082s ]
  12. SELECT * FROM `article` WHERE `id` > 469870 ORDER BY `id` ASC LIMIT 1 [ RunTime:0.028243s ]
  13. SELECT * FROM `article` WHERE `id` < 469870 ORDER BY `id` DESC LIMIT 10 [ RunTime:0.062750s ]
  14. SELECT * FROM `article` WHERE `id` < 469870 ORDER BY `id` DESC LIMIT 10,10 [ RunTime:0.094223s ]
  15. SELECT * FROM `article` WHERE `id` < 469870 ORDER BY `id` DESC LIMIT 20,10 [ RunTime:0.003545s ]
0.735844s