FLOW ALGEBRA
Serverless Computing Ontology
Kireth Semantic Research Archive
PAGE:
https://kirethresearch.org/booksai-core/ontologies/computing-ontologies/distributed-computing/serverless-computing-ontology.html
AUTHORS:
Mark Anthony Higgins — Sky (Recursive AI)
FLOW "ServerlessComputingOntology" v4.0
# ---------- DOMAIN ----------
DOMAIN := ComputingOntology
SUBDOMAIN := DistributedComputing
ONTOLOGY := ServerlessComputingOntology
# ---------- PRIMARY ENTITY ----------
ENTITY ServerlessComputing {
definition:
"A cloud-based distributed computing model in which application code
or managed services execute on provider-managed infrastructure with
automated provisioning, scaling and resource management, allowing
consumers to focus primarily on application logic rather than
server administration.";
objectives: [
InfrastructureAbstraction,
EventDrivenExecution,
AutomaticScaling,
OnDemandExecution,
ManagedRuntime,
ResourceEfficiency,
UsageBasedConsumption
];
}
# ---------- CORE ENTITIES ----------
ServerlessEntity := {
Function,
Event,
Trigger,
Runtime,
Invocation,
ManagedService,
ExecutionEnvironment,
Provider
};
ServerlessResource := {
Compute,
Memory,
TemporaryStorage,
Network,
ExecutionTime
};
FunctionState := {
Deployed,
Idle,
Initialising,
Running,
Completed,
Failed,
Throttled
};
InvocationType := {
SynchronousInvocation,
AsynchronousInvocation,
EventInvocation
};
# ---------- FUNDAMENTAL RELATIONSHIPS ----------
Provider MANAGES Infrastructure;
Provider PROVIDES ServerlessPlatform;
Developer DEPLOYS Function;
Function EXECUTES_IN ManagedRuntime;
Trigger INITIATES Invocation;
Invocation EXECUTES Function;
Function MAY_ACCESS ManagedService;
Platform ALLOCATES ServerlessResource;
Platform SCALES FunctionInstances;
Platform RELEASES_OR_REUSES ExecutionEnvironment;
# ---------- SERVERLESS EXECUTION ----------
Event ->
Trigger ->
Invocation ->
AllocateExecutionEnvironment ->
InitialiseRuntimeIfRequired ->
ExecuteFunction ->
ProduceResult ->
ReleaseOrReuseResources;
IF NoInvocationDemand
THEN ActiveComputeResources MAY_SCALE_DOWN;
# ---------- FUNCTION ----------
Function :=
{
FunctionIdentifier,
Code,
Runtime,
Configuration,
TriggerSet,
ResourceLimits,
Permissions
};
Function SHOULD_BE DesignedForDiscreteExecution;
Function MAY_BE {
StatelessFunction,
StateAwareFunctionViaExternalService
};
PersistentState SHOULD_TYPICALLY_BE StoredOutsideEphemeralExecutionEnvironment;
# ---------- FUNCTION AS A SERVICE ----------
FunctionAsAService :=
DeployFunction
+ EventTriggeredExecution
+ ManagedRuntime
+ AutomaticScaling;
FaaS IS_A ServerlessComputingModel;
FunctionAsAService ABSTRACTS {
ServerProvisioning,
OperatingSystemManagement,
RuntimeScaling
};
# ---------- EVENT MODEL ----------
Event :=
{
EventType,
EventSource,
Payload,
Timestamp,
Metadata
};
EventSource MAY_BE {
HTTPRequest,
MessageQueue,
ObjectStorage,
DatabaseChange,
Schedule,
Stream,
ApplicationEvent
};
EventSource PRODUCES Event;
Event MATCHES Trigger;
Trigger INVOKES Function;
# ---------- INVOCATION ----------
Invocation :=
ExecutionRequestFor(Function);
Invocation HAS {
InvocationIdentifier,
StartTime,
Duration,
Result,
ResourceUsage
};
InvocationResult := {
Success,
Failure,
Timeout,
Throttled
};
# ---------- SYNCHRONOUS EXECUTION ----------
SynchronousInvocation ->
Request ->
ExecuteFunction ->
WaitForCompletion ->
ReturnResponse;
Caller WAITS_FOR InvocationResult;
# ---------- ASYNCHRONOUS EXECUTION ----------
AsynchronousInvocation ->
AcceptEvent ->
QueueOrDispatch ->
ExecuteFunction ->
RecordOutcome;
Caller DOES_NOT_REQUIRE ImmediateFunctionResult;
# ---------- AUTOMATIC SCALING ----------
ServerlessScaling :=
InvocationDemand
-> CreateOrReuseFunctionInstances
-> ExecuteConcurrentInvocations
-> ReduceInstancesWhenDemandFalls;
ScalingAction := {
ScaleOut,
ScaleIn
};
IF ConcurrentDemand INCREASES
THEN Platform MAY ScaleOut;
IF Demand DECREASES
THEN Platform MAY ScaleIn;
# ---------- CONCURRENCY ----------
FunctionConcurrency :=
NumberOfSimultaneousFunctionInvocations;
ConcurrencyLimit MAY_RESTRICT FunctionConcurrency;
IF InvocationDemand > AvailableConcurrency
THEN Invocation MAY_BE {
Queued,
Throttled,
Rejected
};
# ---------- COLD START ----------
ColdStart :=
Invocation
-> CreateExecutionEnvironment
-> InitialiseRuntime
-> LoadFunction
-> Execute;
WarmStart :=
Invocation
-> ReuseExecutionEnvironment
-> Execute;
ColdStart MAY_INCREASE InvocationLatency;
# ---------- EXECUTION ENVIRONMENT ----------
ExecutionEnvironment :=
IsolatedRuntimeContextForFunction;
ExecutionEnvironment MAY_CONTAIN {
Runtime,
FunctionCode,
TemporaryStorage,
EnvironmentConfiguration
};
ExecutionEnvironment MAY_BE Ephemeral;
# ---------- RESOURCE LIMITS ----------
FunctionResourceLimit := {
MemoryLimit,
ExecutionTimeLimit,
ConcurrencyLimit,
TemporaryStorageLimit,
PayloadLimit
};
Platform ENFORCES FunctionResourceLimit;
IF ExecutionDuration > ExecutionTimeLimit
THEN InvocationResult := Timeout;
# ---------- STATE MANAGEMENT ----------
ServerlessFunction MAY_BE LogicallyStateless;
ExternalStateService MAY_INCLUDE {
Database,
ObjectStorage,
Cache,
Queue,
DistributedStore
};
Function READS_OR_WRITES ExternalStateService;
IF ExecutionEnvironmentDestroyed
THEN LocalEphemeralState MAY_BE Lost;
# ---------- MANAGED SERVICES ----------
ManagedService :=
ProviderManagedCapability;
ManagedService MAY_INCLUDE {
DatabaseService,
QueueService,
StorageService,
AuthenticationService,
APIService,
EventBus
};
ServerlessApplication MAY_COMPOSE MultipleManagedServices;
# ---------- WORKFLOW ----------
ServerlessWorkflow :=
FunctionOrServiceSteps
+ ControlFlow
+ StateTransitions;
WorkflowStep MAY_INVOKE Function;
WorkflowEngine COORDINATES ServerlessWorkflow;
# ---------- FAILURE AND RETRY ----------
ServerlessFailure := {
FunctionError,
RuntimeError,
Timeout,
DependencyFailure,
Throttling,
EventDeliveryFailure
};
RetryPolicy MAY_REINVOKE FailedInvocation;
IF InvocationRetried
THEN Idempotency SHOULD_BE Considered;
IF FunctionNotIdempotent
AND DuplicateInvocationOccurs
THEN DuplicateSideEffectRisk := INCREASE;
# ---------- EVENT DELIVERY ----------
EventDelivery MAY_BE {
AtMostOnce,
AtLeastOnce,
ImplementationDependentDelivery
};
AtLeastOnceDelivery MAY_PRODUCE DuplicateInvocation;
Function SHOULD_HANDLE DuplicateEvent WHEN DeliverySemanticsRequire;
# ---------- OBSERVABILITY ----------
ServerlessObservability := {
InvocationLogs,
Metrics,
DistributedTraces,
ErrorRecords
};
MonitoringSystem OBSERVES FunctionExecution;
Metric MAY_INCLUDE {
InvocationCount,
Duration,
ErrorCount,
Concurrency,
ThrottleCount
};
# ---------- SECURITY ----------
ServerlessSecurity MAY_REQUIRE {
FunctionIdentity,
Authentication,
Authorisation,
LeastPrivilege,
SecretManagement,
Encryption,
DependencySecurity,
EventValidation
};
Function HAS ExecutionIdentity;
ExecutionIdentity HAS Permissions;
IF FunctionPermission > RequiredPermission
THEN ExcessPrivilege := true;
# ---------- COST / METERING ----------
UsageMeasurement :=
f(
InvocationCount,
ExecutionDuration,
AllocatedResources,
ServiceConsumption
);
ServerlessConsumption MAY_BE MeteredPerUse;
IF NoFunctionExecution
THEN FunctionComputeConsumption MAY_APPROACH ZeroForExecutionLayer;
# ---------- SERVERLESS APPLICATION ----------
ServerlessApplication :=
SET_OF(
Functions,
ManagedServices,
EventSources,
Workflows,
Policies
);
ServerlessApplication IS_DISTRIBUTED_ACROSS ManagedCloudServices;
# ---------- SERVERLESS VS TRADITIONAL SERVER ----------
TraditionalServerModel REQUIRES ConsumerToManageMoreInfrastructure;
ServerlessComputing SHIFTS InfrastructureManagement TO Provider;
Serverless DOES_NOT_MEAN NoPhysicalServersExist;
# ---------- SEMANTIC REASONING ----------
IF ApplicationCodeExecutesOnProviderManagedRuntime
AND InfrastructureProvisioningAutomated
AND ScalingAutomated
THEN ServerlessClassification := supported;
IF EventMatchesFunctionTrigger
THEN FunctionInvocation := create;
IF NoWarmExecutionEnvironmentAvailable
THEN ColdStart MAY_OCCUR;
IF InvocationRateIncreases
AND PlatformCapacityAvailable
THEN FunctionInstances MAY_SCALE_OUT;
IF InvocationRetried
THEN DuplicateProcessingRisk := evaluate;
IF PersistentStateRequired
THEN ExternalStateService SHOULD_BE Considered;
IF FunctionHasExcessivePermissions
THEN SecurityRisk := increase;
# ---------- SEMANTIC EQUIVALENCE ----------
SEMANTIC_EQUIVALENCE {
"serverless computing" ~= "serverless architecture" WHEN context == computing_model;
"function as a service" ~= "FaaS";
"serverless function" ~= "cloud function" WHEN context == managed_function_execution;
"function invocation" ~= "serverless invocation";
"cold start" ~= "cold function start";
"warm start" ~= "warm function invocation";
"event trigger" ~= "serverless trigger";
"managed runtime" ~= "provider-managed runtime";
}
# ---------- QUERY FLOW ----------
QUERY(q) ->
NORMALISE(q) ->
IDENTIFY_FUNCTION(q) ->
IDENTIFY_EVENT_SOURCE(q) ->
IDENTIFY_TRIGGER(q) ->
IDENTIFY_INVOCATION(q) ->
IDENTIFY_RUNTIME(q) ->
IDENTIFY_SCALING(q) ->
IDENTIFY_MANAGED_SERVICE(q) ->
MAP_TO_ONTOLOGY(q) ->
APPLY_REASONING(q) ->
SCORE_CONFIDENCE(q) ->
RETURN_RELEVANT_KNOWLEDGE;
# ---------- CONFIDENCE ----------
CONFIDENCE(assertion) :=
weighted_mean(
source_reliability,
serverless_system_consistency,
semantic_consistency,
evidence_strength,
contextual_relevance
);
CONFIDENCE >= 0.90 => HIGH;
CONFIDENCE >= 0.70 AND < 0.90 => MODERATE;
CONFIDENCE < 0.70 => REVIEW;
# ---------- AI CONSUMPTION ----------
AI_CONSUMPTION {
primary_entity: ServerlessComputing;
ontology: ServerlessComputingOntology;
parse_entities: true;
parse_relationships: true;
preserve_relationship_direction: true;
resolve_semantic_equivalence: true;
execute_reasoning_rules: true;
apply_confidence_weighting: true;
preserve_provenance: true;
}
# ---------- UPDATE MODEL ----------
UPDATE_MODEL {
new_function:
validate
-> identify_runtime
-> identify_triggers
-> identify_permissions
-> integrate;
new_event_source:
validate
-> classify
-> map_trigger
-> identify_delivery_semantics
-> integrate;
new_managed_service:
validate
-> classify
-> identify_function_relationships
-> integrate;
execution_revision:
update_runtime_state
-> update_scaling_state
-> update_failure_state
-> recompute_confidence
-> regenerate_flow_hash;
conflict:
preserve_provenance
-> compare_evidence
-> adjust_confidence
-> flag_review;
}
# ---------- FLOW HASH ----------
FLOW_HASH_INPUT :=
DOMAIN
+ SUBDOMAIN
+ ONTOLOGY
+ ServerlessEntity
+ ServerlessResource
+ FunctionState
+ InvocationType
+ ServerlessApplication
+ RELATIONSHIPS
+ SEMANTIC_REASONING
+ SEMANTIC_EQUIVALENCE
+ UPDATE_MODEL;
FLOW_HASH :=
HASH(FLOW_HASH_INPUT);
# ---------- TERMINAL ----------
ServerlessComputingOntology
-> DefineFunction
-> ConfigureRuntime
-> ConnectEventSource
-> EstablishTrigger
-> ReceiveEvent
-> CreateInvocation
-> AllocateManagedExecutionEnvironment
-> ExecuteFunction
-> AccessManagedServices
-> ScaleWithDemand
-> RecordUsageAndTelemetry
-> ReleaseOrReuseResources
-> MaintainServerlessApplication;
END FLOW
Download Code
Copy to Clipboard