الطريق إلى GraphQL الموحدة

صورة من dgraph.io
صورة من dgraph.io

يحب المبرمجون القصص الجيدة ، لذلك آمل أن تكون الرحلة التي تستغرق خمس سنوات إلى واجهة برمجة تطبيقات مركبة باستخدام GraphQL في بيئة إنتاج (في ذروة 110 طلبًا في الثانية عند زمن انتقال 100 مللي ثانية) ممتعة.

[إذا كنت تسرع ، proskrolte أدناه للدروس وإلقاء نظرة على المصدر المفتوح graphql-schema-Registry ]

سجل المخطط مع نموذج مخطط الاختبار
سجل المخطط مع نموذج مخطط الاختبار

مهمة

, Pipedrive ( 2020 10 ), REST API . /users/self, , , 30 . PHP , . , .

/ المستخدمين / التوزيع الذاتي للكمون لحركة المرور المتبقية
/users/self

, .

, graphql.

3-4 , , , - - elixir graphql. MySQL Pipedrive /graphql.

, , - CRUD, .

2019, , GraphQL stitching graphql-compose REST API. , , - graphql .

:

2019, , Apollo , . , Core, .

, POST gateway .

graphql - . , Protobuf Thrift, GRPCOData.

, graphql (insights, teams) , ( User). typescript + relay , .

.

, - API ? ? Gateway - ? .

, - , - . Confluent’s schema-registry  Atlassian’s Braid, , Java, .

3 :

  • ( ) 15%. REST /graphql

  • 30%. graphql .

  • (- )

, , .. .

طلبات الشبكة أثناء تحميل تطبيق الويب
-

:

الخدمات التي تعمل عليها

schema-registry , , (swagger, typescript, graphql, avro, proto). .

Gateway schema-registry . frontend autocomplete .

, graphql , , .

/users/self - ? (!). - , .

( 2020), - 13% 25% (- ), UI Datadog.

, - REST.

- ( 600+ ), - . IOS- Android- graphql .

60 , -

? , .

Mark Stuart, Paypal Engineering

Apollo studio    . gateway.

مجموعة أدوات التحقق من صحة المخطط المكتوبة

, - , - . opensource - graphql-schema-registry.

- Pipedrive. , DC . , , , ?

graphql gateway . , gateway .

, gateway , - . Apollo studio - .

, Apollo , .. . .

, ( -) . . Gateway schema-registry /schema/compose , .

schema-registry ,

تسجيل النظام عند بدء الخدمة

REST Graphql API, , REST.

REST

REST graphql, openapi-to-graphql, .

- , , ? REST .

, REST API , .

REST API . , - deal.pipeline_id. graphql, ,

json-. , REST _, .

رسم بياني للبيانات الموحدة Pipedrive (يسار) مع خدمتين (من أصل 539) ورسم بياني لخدمة العملاء المتوقعين غير المتحدين (يمين)
Pipedrive () 2 ( 539) -- leads ()

CQRS

Pipedrive TTL-.

, , . , . 3 .

- PHP-, nodejs ( monograph), memcached. -. , .

CQRS pattern. , 80% .

متوسط ​​وقت استجابة استجابة monolith (يسار) وبوابة Graphql (يمين) في منطقة الولايات المتحدة بناءً على NewRelic
() graphql gateway () US NewRelic

- . , - . - , identity. .

Identity , kafka, monograph . , ( 1 ), . , - .

APM - . Datadog .

, 30 memcached. . memcached 10, , 220. , - mcrouter. , 20 .

- , getMulti . resolver' , 5 debounce .

. graphql gateway . , .

28 30 , 500, .

graphql , /graphql . 3-5 , ( debounce FE )

, - (APM) tracing:true, .

700 300 . , ( performance.now()), .

graphql gateway  Chrome DevTools, , .

  .

, graphql . /graphql ( vendors.js) . , - - .

- graphql    gql . bundle, fetch. , - - . server-side-rendering service workers .

استعلام التفاف / رسم بياني اليسار
/graphql

graphql , . , , rate limit .

graphql-cost-analysis , , - , , ( , , CPU, ). gateway schema-registry. .

js/typescript . graphql .

koa-graphql  apollo-server-koa GraphQLSchema . apollo/server :

buildFederatedSchema([{typeDefs, resolvers}])

, , gql , schema.graphql , ,  ASTNode ( parse / buildASTSchema)

canary

- .

, graphql 100 -"". 1000 , 1%, 10%, 30%, 50% .

company ID . , - , graphql . - graphql .

, , ( ), .

- graphql , - , , . - .

graphql API , API. OAuth ( ) .

schema-registry , gateway - , , , (persisted query), .

, go, - GRPC - , graphql , gateway. GRPC - , graphql msgpack?

بالنسبة للعالم الخارجي ، آمل أن تسرع Apollo مع مشروع Constellation الخاص بها في معالجة طلب Rust بحيث لا تكون ضريبة الأداء هذه بنسبة 10٪ موجودة وستكون قادرة على توحيد خدمات الرسم البياني دون تغييرات كبيرة على الأخير.

بشكل عام ، وقت رائع للاستمتاع بالتطوير حيث يوجد الكثير من التعقيد!




All Articles