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

Python concurrent模块详细介绍

  • 2026-01-31 19:10:35
Python concurrent模块详细介绍

1. 创始时间与作者

  • 创始时间concurrent.futures 模块随 Python 3.2 版本于 2011年2月 发布

  • 核心开发者

    • Brian Quinlan:concurrent.futures 模块的主要设计者和实现者

    • Guido van Rossum:Python 创始人,对并发编程模型有重要影响

    • Python 核心团队:持续改进和优化异步编程接口

  • 项目定位:Python 高级并发编程接口,提供线程和进程池的统—抽象

2. 官方资源

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

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

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

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

3. 核心功能

4. 应用场景

1. 基础线程池使用
import concurrent.futuresimport urllib.requestimport timedef download_url(url):"""下载URL内容"""print(f"开始下载: {url}")start_time = time.time()with urllib.request.urlopen(urltimeout=10as response:content = response.read()size = len(content)end_time = time.time()print(f"下载完成: {url}, 大小: {size} 字节, 耗时: {end_time - start_time:.2f}秒")return sizedef basic_threadpool_demo():"""基础线程池演示"""urls = ['http://www.python.org','http://www.google.com','http://www.github.com','http://www.stackoverflow.com','http://www.wikipedia.org'    ]# 使用线程池执行器with concurrent.futures.ThreadPoolExecutor(max_workers=3as executor:# 方法1: submit - 逐个提交任务print("=== submit 方法 ===")future_to_url = {executor.submit(download_urlurl): urlfor url in urls        }# 收集结果results = []for future in concurrent.futures.as_completed(future_to_url):url = future_to_url[future]try:result = future.result()results.append((urlresult))print(f"URL: {url}, 结果: {result}")except Exception as e:print(f"URL: {url} 发生异常: {e}")print(f"总共下载了 {len(results)} 个URL")if __name__ == '__main__':basic_threadpool_demo()
2. 进程池并行计算
import concurrent.futuresimport mathimport timedef is_prime(n):"""检查数字是否为素数"""if n<2:return Falseif n == 2:return Trueif n%2 == 0:return Falsesqrt_n = int(math.floor(math.sqrt(n)))for in range(3sqrt_n+12):if n%i == 0:return Falsereturn Truedef count_primes_in_range(start_end):"""计算指定范围内的素数数量"""startend = start_endcount = 0for num in range(startend+1):if is_prime(num):count += 1return countdef process_pool_demo():"""进程池演示"""# 定义计算范围ranges = [        (150000),        (50001100000),        (100001150000),        (150001200000)    ]print(f"开始并行计算素数,使用 {concurrent.futures.cpu_count()} 个CPU核心")start_time = time.time()# 使用进程池执行器with concurrent.futures.ProcessPoolExecutor() as executor:# 方法1: map - 顺序保持print("=== map 方法 ===")results_map = list(executor.map(count_primes_in_rangeranges))# 方法2: submit + as_completedprint("=== submit + as_completed 方法 ===")future_to_range = {executor.submit(count_primes_in_ranger): rfor in ranges        }results_async = []for future in concurrent.futures.as_completed(future_to_range):r = future_to_range[future]result = future.result()results_async.append(result)print(f"范围 {r} 完成,找到 {result} 个素数")end_time = time.time()total_primes_map = sum(results_map)total_primes_async = sum(results_async)print(f"\n计算结果:")print(f"map 方法总素数: {total_primes_map}")print(f"异步方法总素数: {total_primes_async}")print(f"总耗时: {end_time - start_time:.2f} 秒")if __name__ == '__main__':process_pool_demo()
3. 高级任务调度与回调
import concurrent.futuresimport timeimport randomimport threadingclass AdvancedTaskManager:"""高级任务管理器"""def __init__(selfmax_workers=None):self.executor = concurrent.futures.ThreadPoolExecutor(max_workers=max_workers)self.completed_tasks = 0self.failed_tasks = 0self.lock = threading.Lock()self.results = []def complex_task(selftask_idduration):"""复杂任务模拟"""print(f"任务 {task_id} 开始执行,预计耗时 {duration:.1f}秒")# 模拟任务执行time.sleep(duration)# 模拟随机失败if random.random() <0.1:  # 10% 失败率raise Exception(f"任务 {task_id} 执行失败")result = f"任务 {task_id} 完成,结果: {task_id * 100}"print(f"任务 {task_id} 执行成功")return resultdef task_completed_callback(selffuturetask_id):"""任务完成回调"""try:result = future.result()with self.lock:self.completed_tasks += 1self.results.append((task_idresult'success'))print(f"回调: 任务 {task_id} 成功完成")except Exception as e:with self.lock:self.failed_tasks += 1self.results.append((task_idstr(e), 'failed'))print(f"回调: 任务 {task_id} 失败: {e}")def submit_tasks(selfnum_tasks):"""提交多个任务"""futures = []for in range(num_tasks):# 随机任务时长duration = random.uniform(15)# 提交任务future = self.executor.submit(self.complex_taskiduration)# 添加回调future.add_done_callback(lambda ftask_id=iself.task_completed_callback(ftask_id)            )futures.append(future)return futuresdef wait_for_completion(selffuturestimeout=None):"""等待任务完成"""# 使用 wait 方法等待完成donenot_done = concurrent.futures.wait(futurestimeout=timeout,return_when=concurrent.futures.ALL_COMPLETED        )print(f"\n任务完成情况:")print(f"已完成: {len(done)}")print(f"未完成: {len(not_done)}")return donenot_donedef get_statistics(self):"""获取统计信息"""with self.lock:return {'completed'self.completed_tasks,'failed'self.failed_tasks,'total'self.completed_tasks+self.failed_tasks,'success_rate'self.completed_tasks/ (self.completed_tasks+self.failed_tasks*100if (self.completed_tasks+self.failed_tasks>else 0            }def shutdown(self):"""关闭执行器"""self.executor.shutdown(wait=True)def advanced_demo():"""高级功能演示"""manager = AdvancedTaskManager(max_workers=3)try:# 提交任务print("提交任务...")futures = manager.submit_tasks(10)# 等待任务完成print("等待任务完成...")donenot_done = manager.wait_for_completion(futurestimeout=30)# 显示统计信息stats = manager.get_statistics()print(f"\n最终统计:")print(f"成功任务: {stats['completed']}")print(f"失败任务: {stats['failed']}")print(f"成功率: {stats['success_rate']:.1f}%")# 显示结果print(f"\n任务结果:")for task_idresultstatus in manager.results:print(f"任务 {task_id}: {status} - {result}")finally:manager.shutdown()if __name__ == '__main__':advanced_demo()
4. 性能对比分析
import concurrent.futuresimport timeimport mathfrom typing import ListCallabledef performance_comparison():"""性能对比分析"""def cpu_intensive_work(nint->float:"""CPU密集型工作"""return sum(math.sqrt(ifor in range(n))def io_intensive_work(durationfloat->str:"""I/O密集型工作"""time.sleep(duration)return f"IO工作完成,耗时 {duration}秒"def run_sequential(tasksListwork_funcCallable):"""顺序执行"""start_time = time.time()results = [work_func(taskfortaskintasks]end_time = time.time()return resultsend_time-start_timedef run_threadpool(tasksListwork_funcCallablemax_workersint):"""线程池执行"""start_time = time.time()with concurrent.futures.ThreadPoolExecutor(max_workers=max_workersas executor:results = list(executor.map(work_functasks))end_time = time.time()return resultsend_time-start_timedef run_processpool(tasksListwork_funcCallablemax_workersint):"""进程池执行"""start_time = time.time()with concurrent.futures.ProcessPoolExecutor(max_workers=max_workersasexecutor:results = list(executor.map(work_functasks))end_time = time.time()return resultsend_time-start_time# CPU密集型任务测试print("=== CPU密集型任务测试 ===")cpu_tasks = [1000000*8# 8个相同的CPU密集型任务# 顺序执行_seq_time = run_sequential(cpu_taskscpu_intensive_work)# 线程池执行_thread_time = run_threadpool(cpu_taskscpu_intensive_work4)# 进程池执行_process_time = run_processpool(cpu_taskscpu_intensive_work4)print(f"顺序执行耗时: {seq_time:.2f}秒")print(f"线程池执行耗时: {thread_time:.2f}秒")print(f"进程池执行耗时: {process_time:.2f}秒")print(f"进程池加速比: {seq_time / process_time:.2f}x")# I/O密集型任务测试print("\n=== I/O密集型任务测试 ===")io_tasks = [0.5*8# 8个相同的I/O密集型任务# 顺序执行_seq_time_io = run_sequential(io_tasksio_intensive_work)# 线程池执行_thread_time_io = run_threadpool(io_tasksio_intensive_work8)# 进程池执行_process_time_io = run_processpool(io_tasksio_intensive_work8)print(f"顺序执行耗时: {seq_time_io:.2f}秒")print(f"线程池执行耗时: {thread_time_io:.2f}秒")print(f"进程池执行耗时: {process_time_io:.2f}秒")print(f"线程池加速比: {seq_time_io / thread_time_io:.2f}x")# 性能分析总结print("\n=== 性能分析总结 ===")print("CPU密集型任务:")print("  - 进程池表现最佳(绕过GIL限制)")print("  - 线程池受GIL限制,性能接近顺序执行")print("\nI/O密集型任务:")print("  - 线程池表现最佳(创建开销小)")print("  - 进程池创建开销较大,但仍优于顺序执行")if __name__ == '__main__':performance_comparison()

5. 底层逻辑与技术原理

核心架构
关键技术
  1. Executor 设计模式

    # 统一的执行器接口class Executor:def submit(selffn*args**kwargs->Futuredef map(selffn*iterablestimeout=None->Iteratordef shutdown(selfwait=True)
  2. Future 对象

    • 代表异步计算的结果

    • 提供结果查询、等待、回调等功能

    • 状态:pending → running → finished

  3. 线程池实现

    • 基于 threading 模块

    • 工作线程复用,减少创建开销

    • 线程安全的任务队列

  4. 进程池实现

    • 基于 multiprocessing 模块

    • 使用进程间通信(队列、管道)

    • 独立的内存空间,绕过 GIL

  5. 任务调度策略

    • FIFO:先进先出调度

    • Work Stealing:工作窃取(某些实现)

    • 负载均衡:自动分配任务

Future 状态机
# Future 对象的内部状态class FutureState:PENDING = 'PENDING'# 等待执行RUNNING = 'RUNNING'# 正在执行CANCELLED = 'CANCELLED'# 已取消FINISHED = 'FINISHED'# 已完成EXCEPTION = 'EXCEPTION'# 异常结束

6. 安装与配置

基础安装
# concurrent.futures 是 Python 标准库的一部分,无需额外安装# 验证安装python -c"import concurrent.futures; print(concurrent.futures.__doc__)"
环境要求
组件最低要求推荐配置
Python3.2+3.6+
操作系统Windows/Linux/macOS同左
内存512MB4GB+
CPU多核多核多线程
平台优化配置
import concurrent.futuresimport osdef optimize_executor_config():"""优化执行器配置"""# 获取系统信息cpu_count = os.cpu_count()print(f"CPU 核心数: {cpu_count}")# 根据任务类型推荐配置config = {'cpu_intensive': {'executor''ProcessPoolExecutor','max_workers'cpu_count,'description''CPU密集型任务,使用进程池绕过GIL'        },'io_intensive': {'executor''ThreadPoolExecutor','max_workers'min(32, (cpu_count or 1*5),'description''I/O密集型任务,使用线程池减少开销'        },'mixed_workload': {'executor''ThreadPoolExecutor','max_workers'min(32, (cpu_count or 1*3),'description''混合工作负载,平衡CPU和I/O'        }    }return configif __name__ == '__main__':config = optimize_executor_config()for workloadsettings in config.items():print(f"{workload}: {settings}")

7. 性能指标

操作类型执行时间内存开销适用场景
线程创建0.1-1ms1-8MBI/O密集型任务
进程创建10-100ms10-50MBCPU密集型任务
任务提交0.01-0.1ms可忽略高频任务调度
结果获取0.001-0.01ms可忽略实时结果处理

8. 高级功能使用

1. 自定义执行器
import concurrent.futuresimport threadingimport queueimport timeclass CustomThreadPoolExecutor(concurrent.futures.Executor):"""自定义线程池执行器"""def __init__(selfmax_workers=Nonethread_name_prefix=''):if max_workers is None:max_workers = min(32, (os.cpu_count() or 1*4)self._max_workers = max_workersself._work_queue = queue.Queue()self._threads = set()self._shutdown = Falseself._shutdown_lock = threading.Lock()self._thread_name_prefix = thread_name_prefixdef submit(selffn*args**kwargs):"""提交任务"""with self._shutdown_lock:if self._shutdown:raise RuntimeError('不能在新任务提交后关闭执行器')# 创建Future对象f = concurrent.futures.Future()# 将任务放入队列self._work_queue.put((ffnargskwargs))# 确保有足够的工作线程self._start_worker_if_needed()return fdef _start_worker_if_needed(self):"""如果需要,启动新的工作线程"""if len(self._threadsself._max_workers:t = threading.Thread(target=self._worker,name=f'{self._thread_name_prefix}_{len(self._threads)}'            )t.daemon = Truet.start()self._threads.add(t)def _worker(self):"""工作线程主函数"""while True:try:# 获取任务futurefnargskwargs = self._work_queue.get(timeout=0.1)# 如果执行器已关闭且队列为空,退出if self._shutdown and self._work_queue.empty():break# 执行任务if not future.set_running_or_notify_cancel():continuetry:result = fn(*args**kwargs)future.set_result(result)except Exception as e:future.set_exception(e)except queue.Empty:# 检查是否需要退出if self._shutdown:breakcontinuedef shutdown(selfwait=True):"""关闭执行器"""with self._shutdown_lock:self._shutdown = Trueif wait:for in self._threads:t.join()def custom_executor_demo():"""自定义执行器演示"""def task(n):time.sleep(1)return n*nwith CustomThreadPoolExecutor(max_workers=2as executor:futures = [executor.submit(taskifor in range(5)]results = [f.result() for in futures]print(f"自定义执行器结果: {results}")if __name__ == '__main__':custom_executor_demo()
2. 错误处理与重试机制
import concurrent.futuresimport timeimport randomfrom functools import wrapsdef retry_on_failure(max_retries=3delay=1):"""重试装饰器"""def decorator(func):@wraps(func)def wrapper(*args**kwargs):for attempt in range(max_retries):try:return func(*args**kwargs)except Exception as e:if attempt == max_retries-1:raise eprint(f"尝试 {attempt + 1} 失败: {e}, {delay}秒后重试...")time.sleep(delay)return Nonereturn wrapperreturn decoratorclass RobustTaskManager:"""健壮的任务管理器"""def __init__(selfmax_workers=None):self.executor = concurrent.futures.ThreadPoolExecutor(max_workers=max_workers)@retry_on_failure(max_retries=3delay=1)def unreliable_task(selftask_id):"""不可靠的任务(模拟随机失败)"""# 模拟30%的失败率if random.random() <0.3:raise Exception(f"任务 {task_id} 随机失败")time.sleep(random.uniform(0.52))return f"任务 {task_id} 成功完成"def execute_with_timeout(selftask_idtimeout=3):"""带超时的任务执行"""future = self.executor.submit(self.unreliable_tasktask_id)try:result = future.result(timeout=timeout)return resultexcept concurrent.futures.TimeoutError:future.cancel()returnf"任务 {task_id} 超时"except Exception as e:returnf"任务 {task_id} 失败: {e}"def batch_execute_with_fallback(selftasks):"""批量执行,带降级策略"""results = []with self.executor:# 提交所有任务future_to_task = {self.executor.submit(self.unreliable_tasktask): taskfor task in tasks            }for future in concurrent.futures.as_completed(future_to_task):task = future_to_task[future]try:result = future.result()results.append((taskresult'success'))except Exception as e:# 降级策略:返回默认值fallback_result = f"任务 {task} 降级处理"results.append((taskfallback_result'fallback'))print(f"任务 {task} 失败,使用降级策略: {e}")return resultsdef robust_demo():"""健壮性演示"""manager = RobustTaskManager(max_workers=3)# 单任务超时测试print("=== 单任务超时测试 ===")for in range(3):result = manager.execute_with_timeout(itimeout=2)print(result)# 批量执行测试print("\n=== 批量执行测试 ===")tasks = list(range(10))results = manager.batch_execute_with_fallback(tasks)success_count = sum(for __status in results if status == 'success')fallback_count = sum(for __status in results if status == 'fallback')print(f"成功任务: {success_count}")print(f"降级任务: {fallback_count}")print(f"成功率: {success_count / len(results) * 100:.1f}%")if __name__ == '__main__':robust_demo()

9. 与同类工具对比

特性concurrent.futuresthreadingmultiprocessingasyncio
抽象级别
编程模型同步/异步混合同步同步异步
执行单元线程/进程线程进程协程
GIL 影响线程池受限制受限制
内存开销中等
适用场景通用并发I/O密集型CPU密集型I/O密集型

10. 企业级应用案例

  1. Web 服务

    • Django、Flask 应用的并发请求处理

    • 异步数据库查询和外部 API 调用

  2. 数据处理

    • Pandas 数据框的并行处理

    • 大规模数据清洗和转换

  3. 机器学习

    • Scikit-learn 的并行模型训练

    • 超参数搜索和交叉验证

  4. 网络爬虫

    • 并发网页下载和解析

    • 分布式数据采集系统

  5. 金融分析

    • 并行风险评估计算

    • 实时市场数据分析


总结

concurrent.futures 是 Python 并发编程的现代化接口,核心价值在于:

  1. 统一抽象:线程和进程的统一编程接口

  2. 简单易用:高级 API 隐藏底层复杂性

  3. 灵活强大:支持多种并发模式和调度策略

  4. 未来兼容:为异步编程提供平滑过渡

技术亮点

  • Future 模式提供统一的异步结果处理

  • 执行器接口支持多种并发后端

  • 丰富的任务调度和结果收集机制

  • 内置错误处理和超时控制

适用场景

  • 需要简单并发解决方案的应用

  • 混合型工作负载(CPU + I/O)

  • 快速原型开发和概念验证

  • 教育和小型项目开发

安装使用

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

学习资源

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

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

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

concurrent.futures 模块作为 Python 并发编程的现代化入口点,为开发者提供了简单而强大的工具来处理各种并发场景,是每个 Python 开发者都应该掌握的并发编程工具。

最新文章

随机文章

基本 文件 流程 错误 SQL 调试
  1. 请求信息 : 2026-02-07 13:33:31 HTTP/2.0 GET : https://f.mffb.com.cn/a/470465.html
  2. 运行时间 : 0.122769s [ 吞吐率:8.15req/s ] 内存消耗:4,692.62kb 文件加载:140
  3. 缓存信息 : 0 reads,0 writes
  4. 会话信息 : SESSION_ID=ad41b8d0c2ea8021c8fa4db5b8650c67
  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.000375s ] mysql:host=127.0.0.1;port=3306;dbname=f_mffb;charset=utf8mb4
  2. SHOW FULL COLUMNS FROM `fenlei` [ RunTime:0.000690s ]
  3. SELECT * FROM `fenlei` WHERE `fid` = 0 [ RunTime:0.000230s ]
  4. SELECT * FROM `fenlei` WHERE `fid` = 63 [ RunTime:0.000300s ]
  5. SHOW FULL COLUMNS FROM `set` [ RunTime:0.000622s ]
  6. SELECT * FROM `set` [ RunTime:0.008277s ]
  7. SHOW FULL COLUMNS FROM `article` [ RunTime:0.000734s ]
  8. SELECT * FROM `article` WHERE `id` = 470465 LIMIT 1 [ RunTime:0.002694s ]
  9. UPDATE `article` SET `lasttime` = 1770442411 WHERE `id` = 470465 [ RunTime:0.002560s ]
  10. SELECT * FROM `fenlei` WHERE `id` = 66 LIMIT 1 [ RunTime:0.000680s ]
  11. SELECT * FROM `article` WHERE `id` < 470465 ORDER BY `id` DESC LIMIT 1 [ RunTime:0.001641s ]
  12. SELECT * FROM `article` WHERE `id` > 470465 ORDER BY `id` ASC LIMIT 1 [ RunTime:0.000435s ]
  13. SELECT * FROM `article` WHERE `id` < 470465 ORDER BY `id` DESC LIMIT 10 [ RunTime:0.006394s ]
  14. SELECT * FROM `article` WHERE `id` < 470465 ORDER BY `id` DESC LIMIT 10,10 [ RunTime:0.021172s ]
  15. SELECT * FROM `article` WHERE `id` < 470465 ORDER BY `id` DESC LIMIT 20,10 [ RunTime:0.005756s ]
0.124703s