# ประสิทธิภาพและการเพิ่มประสิทธิภาพ (Symfony) > Profiler, Blackfire, การเพิ่มประสิทธิภาพ query, lazy loading, eager loading, กลยุทธ์ caching - 22 คำถามสัมภาษณ์ - Senior - [คำถามสัมภาษณ์: Symfony](https://sharpskill.dev/th/technologies/symfony/interview-questions.md) ## 1. วัตถุประสงค์หลักของ Symfony Profiler ในวงจรการพัฒนาคืออะไร? **คำตอบ** Symfony Profiler เป็นเครื่องมือดีบักที่รวบรวมข้อมูลโดยละเอียดเกี่ยวกับแต่ละ HTTP request เช่น เวลาที่ใช้ประมวลผล คำสั่ง SQL การใช้หน่วยความจำ cache events และอื่น ๆ มันช่วยระบุคอขวดและวิเคราะห์พฤติกรรมของแอปพลิเคชันโดยไม่ต้องแก้ไขโค้ด ต่างจาก log แบบดั้งเดิม มันมีอินเทอร์เฟซกราฟิกแบบโต้ตอบที่เข้าถึงได้ผ่าน Web Debug Toolbar ## 2. Blackfire แตกต่างจาก Symfony Profiler อย่างไรในการวิเคราะห์ประสิทธิภาพ? **คำตอบ** Blackfire เป็น profiler สำหรับแอปพลิเคชัน PHP ที่วิเคราะห์โค้ดเชิงลึกในระดับฟังก์ชันต่อฟังก์ชัน พร้อม call graphs การเปรียบเทียบโปรไฟล์ และการตรวจจับ regression ต่างจาก Symfony Profiler ที่ให้ภาพรวมต่อ request โดย Blackfire จะติดตามการทำงานของโค้ดทั้งหมดพร้อมเมตริก CPU หน่วยความจำ และ I/O ในทุกการเรียกฟังก์ชัน อีกทั้งยังช่วยให้เปรียบเทียบประสิทธิภาพระหว่างเวอร์ชันโค้ดต่าง ๆ ได้ ## 3. ความแตกต่างระหว่าง lazy loading และ eager loading ใน Doctrine ORM คืออะไร? **คำตอบ** lazy loading จะโหลดความสัมพันธ์เฉพาะเมื่อมีการเข้าถึงจริงในโค้ด ซึ่งช่วยลดภาระเริ่มต้นแต่อาจก่อให้เกิดปัญหา N+1 ด้วยคำสั่งเพิ่มเติมจำนวนมาก ส่วน eager loading จะโหลดความสัมพันธ์ทันทีพร้อมกับ query หลักผ่าน JOIN ช่วยหลีกเลี่ยง query เพิ่มเติมแต่ก็อาจเพิ่มปริมาณข้อมูลที่ถ่ายโอน การเลือกขึ้นอยู่กับว่าจะใช้ข้อมูลอย่างไร ## มีอีก 19 คำถาม - จะระบุและแก้ปัญหา N+1 queries ด้วย Doctrine ได้อย่างไร? - ควรใช้กลยุทธ์การแคชแบบใดสำหรับข้อมูลที่ไม่ค่อยเปลี่ยนแปลงแต่ถูกอ่านบ่อย? สมัครฟรี: https://sharpskill.dev/th/login ## หัวข้อสัมภาษณ์ Symfony อื่นๆ - [PHP สมัยใหม่ (8.1+)](https://sharpskill.dev/th/technologies/symfony/interview-questions/php-modern-features.md): 20 คำถาม, Junior - [พื้นฐาน Symfony](https://sharpskill.dev/th/technologies/symfony/interview-questions/symfony-basics.md): 25 คำถาม, Junior - [Routing & Controllers](https://sharpskill.dev/th/technologies/symfony/interview-questions/routing-controllers.md): 20 คำถาม, Junior - [Twig & Templates](https://sharpskill.dev/th/technologies/symfony/interview-questions/twig-templates.md): 20 คำถาม, Junior - [พื้นฐาน Doctrine ORM](https://sharpskill.dev/th/technologies/symfony/interview-questions/doctrine-orm-basics.md): 25 คำถาม, Junior - [ฟอร์ม Symfony](https://sharpskill.dev/th/technologies/symfony/interview-questions/forms.md): 22 คำถาม, Junior - [การตรวจสอบความถูกต้องของข้อมูล](https://sharpskill.dev/th/technologies/symfony/interview-questions/validation.md): 18 คำถาม, Junior - [Dependency Injection & Services](https://sharpskill.dev/th/technologies/symfony/interview-questions/dependency-injection.md): 24 คำถาม, Mid-Level - [Security & Authentication](https://sharpskill.dev/th/technologies/symfony/interview-questions/security-authentication.md): 26 คำถาม, Mid-Level - [Doctrine ขั้นสูง](https://sharpskill.dev/th/technologies/symfony/interview-questions/doctrine-advanced.md): 24 คำถาม, Mid-Level - [API Platform](https://sharpskill.dev/th/technologies/symfony/interview-questions/api-platform.md): 22 คำถาม, Mid-Level - [Serializer Component](https://sharpskill.dev/th/technologies/symfony/interview-questions/serializer.md): 20 คำถาม, Mid-Level - [Events & Event Subscribers](https://sharpskill.dev/th/technologies/symfony/interview-questions/events-subscribers.md): 20 คำถาม, Mid-Level - [Console & Commands](https://sharpskill.dev/th/technologies/symfony/interview-questions/console-commands.md): 18 คำถาม, Mid-Level - [Messenger Component](https://sharpskill.dev/th/technologies/symfony/interview-questions/messenger.md): 22 คำถาม, Mid-Level - [HTTP Client](https://sharpskill.dev/th/technologies/symfony/interview-questions/http-client.md): 18 คำถาม, Mid-Level - [Cache & ประสิทธิภาพ](https://sharpskill.dev/th/technologies/symfony/interview-questions/cache.md): 20 คำถาม, Mid-Level - [Workflow Component](https://sharpskill.dev/th/technologies/symfony/interview-questions/workflow.md): 18 คำถาม, Mid-Level - [Testing Symfony](https://sharpskill.dev/th/technologies/symfony/interview-questions/testing.md): 22 คำถาม, Mid-Level - [Mailer Component](https://sharpskill.dev/th/technologies/symfony/interview-questions/mailer.md): 16 คำถาม, Mid-Level - [การแปลและ i18n](https://sharpskill.dev/th/technologies/symfony/interview-questions/translations.md): 16 คำถาม, Mid-Level - [EasyAdmin Bundle](https://sharpskill.dev/th/technologies/symfony/interview-questions/easyadmin.md): 18 คำถาม, Mid-Level - [สถาปัตยกรรม Symfony](https://sharpskill.dev/th/technologies/symfony/interview-questions/architecture-patterns.md): 24 คำถาม, Senior - [ความปลอดภัยขั้นสูง](https://sharpskill.dev/th/technologies/symfony/interview-questions/security-advanced.md): 22 คำถาม, Senior - [Custom Bundles](https://sharpskill.dev/th/technologies/symfony/interview-questions/custom-bundles.md): 20 คำถาม, Senior - [Microservices ด้วย Symfony](https://sharpskill.dev/th/technologies/symfony/interview-questions/microservices.md): 22 คำถาม, Senior - [Real-time & WebSockets](https://sharpskill.dev/th/technologies/symfony/interview-questions/real-time.md): 18 คำถาม, Senior - [Deployment & DevOps](https://sharpskill.dev/th/technologies/symfony/interview-questions/deployment-devops.md): 20 คำถาม, Senior --- Source: SharpSkill (https://sharpskill.dev), tech interview preparation for your real stack. HTML version of this page: https://sharpskill.dev/th/technologies/symfony/interview-questions/performance-optimization